changes to blocks and styles
This commit is contained in:
@ -115,6 +115,15 @@ function lcp_register_settings() {
|
||||
'lcp_theme_settings_section' // Section where this field belongs
|
||||
);
|
||||
|
||||
add_settings_field(
|
||||
'enable_highlight_to_share', // Field ID
|
||||
'Enable Highlight-to-Share', // Field title
|
||||
'lcp_enable_highlight_to_share', // Field callback function
|
||||
'lcp_theme_settings_page', // Page where this field appears
|
||||
'lcp_theme_settings_section' // Section where this field belongs
|
||||
);
|
||||
|
||||
|
||||
// Add fields for custom breakpoints
|
||||
add_settings_field(
|
||||
'mobile_breakpoint', // Field ID
|
||||
@ -176,7 +185,7 @@ function lcp_inject_breakpoints_to_frontend() {
|
||||
}
|
||||
</style>";
|
||||
}
|
||||
add_action('wp_head', 'lcp_inject_breakpoints_to_frontend',5);
|
||||
add_action('wp_head', 'lcp_inject_breakpoints_to_frontend');
|
||||
|
||||
|
||||
|
||||
@ -191,6 +200,15 @@ function lcp_enable_key_points_meta_field() {
|
||||
}
|
||||
|
||||
|
||||
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 '<input type="checkbox" name="lcp_theme_settings[enable_highlight_to_share]" value="1" ' . checked( $checked, 1, false ) . ' />';
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -327,3 +345,27 @@ function render_lcp_theme_settings_page() {
|
||||
|
||||
|
||||
|
||||
// Hooks
|
||||
|
||||
function highlight_to_share_popup() {
|
||||
echo "
|
||||
<div class=\"popup\" id=\"popup\">
|
||||
<p>Hey there! Share this:</p>
|
||||
<a href=\"#\" id=\"facebook-share\">Facebook</a> |
|
||||
<a href=\"#\" id=\"twitter-share\">Twitter/X</a>
|
||||
</div>
|
||||
";
|
||||
}
|
||||
|
||||
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');
|
||||
|
||||
@ -18,6 +18,8 @@ class Lcp_Blocks {
|
||||
include $this->template_directory. '/includes/blocks/lcp-dynamic-container/lcp-dynamic-container.php';
|
||||
include $this->template_directory. '/includes/blocks/lcp-key-points/lcp-key-points.php';
|
||||
include $this->template_directory. '/includes/blocks/lcp-button/lcp-button.php';
|
||||
include $this->template_directory. '/includes/blocks/lcp-visualizer/lcp-visualizer.php';
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user