PluginProbe ʕ •ᴥ•ʔ
Ocean Extra / 2.5.7
Ocean Extra v2.5.7
2.5.7 trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.4.1 1.1.4.2 1.1.5 1.1.5.1 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.0.1 1.2.1 1.2.1.1 1.2.1.2 1.2.10 1.2.2 1.2.2.1 1.2.2.2 1.2.2.3 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.10 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.10 1.4.11 1.4.12 1.4.13 1.4.14 1.4.15 1.4.16 1.4.17 1.4.18 1.4.19 1.4.2 1.4.20 1.4.21 1.4.22 1.4.23 1.4.24 1.4.25 1.4.26 1.4.27 1.4.28 1.4.29 1.4.3 1.4.30 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.5.0 1.5.1 1.5.12 1.5.13 1.5.14 1.5.15 1.5.16 1.5.17 1.5.18 1.5.19 1.5.2 1.5.20 1.5.3 1.5.4 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5.0 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6
ocean-extra / includes / custom-code.php
ocean-extra / includes Last commit date
admin-bar 1 year ago client-migration 7 months ago compatibility 1 year ago customizer 1 day ago freemius 9 months ago menu-icons 1 year ago metabox 1 year ago onboarding 1 month ago panel 10 months ago post-settings 3 months ago preloader 1 year ago shortcodes 1 year ago themepanel 1 year ago widgets 1 day ago wizard 3 years ago adobe-font.php 1 year ago custom-code.php 9 months ago dashboard.php 1 year ago image-resizer.php 1 year ago jshrink.php 3 years ago mautic.php 3 months ago ocean-extra-strings.php 3 years ago plugins-tab.php 1 year ago update-message.php 1 year ago utils.php 1 year ago walker.php 4 years ago
custom-code.php
104 lines
1 <?php
2 /**
3 * Custom Code Customizer Options
4 *
5 * @package OceanWP WordPress theme
6 */
7
8 // Exit if accessed directly.
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 if ( ! class_exists( 'OceanWP_Custom_Code_Customizer' ) ) :
14
15 /**
16 * Custom CSS / JS Customizer Class
17 */
18 class OceanWP_Custom_Code_Customizer {
19
20 /**
21 * Setup class.
22 *
23 * @since 1.0
24 */
25 public function __construct() {
26
27 add_action( 'customize_register', array( $this, 'customizer_options' ) );
28 add_action( 'wp_enqueue_scripts', array( $this, 'output_custom_js' ), 9999 );
29
30 }
31
32 /**
33 * Customizer options
34 *
35 * @since 1.0.0
36 *
37 * @param WP_Customize_Manager $wp_customize Theme Customizer object.
38 */
39 public function customizer_options( $wp_customize ) {
40
41 $section = 'ocean_custom_code_panel';
42 $wp_customize->add_section(
43 $section,
44 array(
45 'title' => esc_html__( 'Custom CSS/JS', 'ocean-extra' ),
46 'priority' => 18,
47 )
48 );
49
50 /**
51 * Custom JS
52 */
53 $wp_customize->add_setting(
54 'ocean_custom_js',
55 array(
56 'transport' => 'postMessage',
57 'sanitize_callback' => false,
58 )
59 );
60
61 $wp_customize->add_control(
62 new WP_Customize_Code_Editor_Control(
63 $wp_customize,
64 'ocean_custom_js',
65 array(
66 'label' => esc_html__( 'Custom JS', 'ocean-extra' ),
67 'description' => esc_html__( 'You need to reload to see the changes. No need to add the <script> tags.', 'ocean-extra' ),
68 'code_type' => 'text/javascript',
69 'input_attrs' => array(
70 'aria-describedby' => 'editor-keyboard-trap-help-1 editor-keyboard-trap-help-2 editor-keyboard-trap-help-3 editor-keyboard-trap-help-4',
71 ),
72 'section' => $section,
73 'settings' => 'ocean_custom_js',
74 'priority' => 10,
75 )
76 )
77 );
78
79 }
80
81 /**
82 * Outputs the custom JS
83 *
84 * @since 1.0.0
85 *
86 * @param string $output Custom JS output.
87 */
88 public function output_custom_js() {
89
90 $js = get_theme_mod( 'ocean_custom_js', false );
91 if ( $js ) {
92 // $output .= $js;
93 wp_add_inline_script( 'oceanwp-main', $js );
94 }
95 // return $output;
96
97 }
98
99 }
100
101 endif;
102
103 return new OceanWP_Custom_Code_Customizer();
104