'; } // Callback function for the 'Tablet Breakpoint' field function lcp_tablet_breakpoint_field() { $options = get_option('lcp_theme_settings'); $tablet_breakpoint = isset($options['tablet_breakpoint']) ? $options['tablet_breakpoint'] : 1024; echo ''; } function lcp_theme_settings_sanitize($input) { // Sanitize mobile breakpoint $input['mobile_breakpoint'] = isset($input['mobile_breakpoint']) ? absint($input['mobile_breakpoint']) : 768; // Sanitize tablet breakpoint $input['tablet_breakpoint'] = isset($input['tablet_breakpoint']) ? absint($input['tablet_breakpoint']) : 1024; return $input; } // Function to output the checkbox for 'Enable Key Points Meta' function lcp_enable_key_points_meta_field() { // Retrieve current value for 'enable_key_points_meta' $options = get_option( 'lcp_theme_settings', array() ); $checked = isset( $options['enable_key_points_meta'] ) ? $options['enable_key_points_meta'] : false; // Output the checkbox echo ''; } function lcp_enable_highlight_to_share() { // Retrieve current value for 'enable_highlight_to_share' $options = get_option( 'lcp_theme_settings', array() ); $checked = isset( $options['enable_highlight_to_share'] ) ? $options['enable_highlight_to_share'] : false; // Output the checkbox echo ''; } // The callback function to display the custom code inserterpage content // Register a custom code setting in wp_options to store the custom code snippets function lcp_custom_code_settings_init() { register_setting( 'custom_code_group', 'custom_code_options', 'sanitize_custom_code' ); } add_action( 'admin_init', 'lcp_custom_code_settings_init' ); // Sanitize the custom code input before saving it function sanitize_custom_code( $input ) { // Sanitize each field if ( isset( $input['js_header'] ) ) { $input['js_header'] = sanitize_textarea_field( $input['js_header'] ); } if ( isset( $input['js_footer'] ) ) { $input['js_footer'] = sanitize_textarea_field( $input['js_footer'] ); } if ( isset( $input['css_header'] ) ) { $input['css_header'] = sanitize_textarea_field( $input['css_header'] ); } if ( isset( $input['css_footer'] ) ) { $input['css_footer'] = sanitize_textarea_field( $input['css_footer'] ); } return $input; } function lcp_custom_code_output($hook) { // Disable the custom code inserter if wp_env is set if (defined('LCP_DISABLE_CODE_INSERTER') && LCP_DISABLE_CODE_INSERTER === true) { // Retrieve the custom code options $custom_code = get_option( 'custom_code_options', array() ); // Prevent execution in the admin area if ( is_admin() ) return; // Check if the hook is for the header if ($hook == "header") { // Check and output JS for header if ( isset( $custom_code['js_header'] ) && ! empty( $custom_code['js_header'] ) ) { echo ''; } // Check and output CSS for header if ( isset( $custom_code['css_header'] ) && ! empty( $custom_code['css_header'] ) ) { echo ''; } } // Check if the hook is for the footer if ($hook == "footer") { // Check and output JS for footer if ( isset( $custom_code['js_footer'] ) && ! empty( $custom_code['js_footer'] ) ) { echo ''; } } } } // Attach to wp_head and wp_footer, passing the location as a parameter add_action( 'wp_head', function() { lcp_custom_code_output('header'); }); add_action( 'wp_footer', function() { lcp_custom_code_output('footer'); }); function render_lcp_theme_settings_page() { ?>

Theme Settings

Custom SVG Icons

Custom Code Settings

CSS
JavaScript in Header
JavaScript in Footer

Hey there! Share this:

Facebook | Twitter/X "; } function lcp_wp_head_hooks(){ // Define lcp_theme_settings array from wp_options $options = get_option('lcp_theme_settings', array()); // Echo highlight-to-share markup and enqueue javascript // Highlight-to-share css is already in style.css if ( isset($options['enable_highlight_to_share']) && $options['enable_highlight_to_share'] ) { highlight_to_share_popup(); wp_enqueue_script( 'lcp-highlight-to-share', get_template_directory_uri() . '/assets/js/highlight-to-share.js', array(), null, true ); } } add_action('wp_head', 'lcp_wp_head_hooks'); /* ICONS */