diff --git a/functions.php b/functions.php
index 9949caa..1a08946 100644
--- a/functions.php
+++ b/functions.php
@@ -10,7 +10,8 @@ include get_template_directory() . '/includes/classes/blocks.php';
new Lcp_Blocks();
-
+// Include backend php
+include get_template_directory() . '/includes/classes/backend.php';
function lcp_block_theme_setup() {
@@ -96,22 +97,6 @@ function lcp_custom_svgs_sanitize($input) {
}
// Existing function to render the theme settings page
-function render_lcp_theme_settings_page() {
- ?>
-
-
Theme Settings
-
-
-
-
-
-
-
-
-
-
-
-
-
- ';
-}
-
-// Optional: Sanitization callback function
-function lcp_theme_settings_sanitize( $input ) {
- // Ensure that only the expected values are saved (e.g., bool for the checkbox)
- if ( isset( $input['enable_key_points_meta'] ) ) {
- $input['enable_key_points_meta'] = (bool) $input['enable_key_points_meta']; // Convert to boolean
- }
-
- return $input;
-}
-
-
-// The callback function to display the custom code inserterpage content
-function lcp_custom_code_inserter_page() {
- // Get the stored options from wp_options
- $custom_code = get_option( 'custom_code_options', array() );
-
- ?>
-
-
Custom Code Settings
-
-
- ' . $custom_code['js_header'] . '';
- }
-
- // 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');
-});
-
-
-
// Hook into wp_footer to add the login form in the footer
-function add_login_form_to_footer() {
- ?>
-
-
-
-
-
-
-
-
-
- |
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+ ';
+}
+
+// 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;
+}
+
+// Inject breakpoints to frontned
+function lcp_inject_breakpoints_to_frontend() {
+ // Get the breakpoints from the settings
+ $options = get_option('lcp_theme_settings');
+ $mobile_breakpoint = isset($options['mobile_breakpoint']) ? $options['mobile_breakpoint'] : 768;
+ $tablet_breakpoint = isset($options['tablet_breakpoint']) ? $options['tablet_breakpoint'] : 1024;
+
+ // Inject the CSS variables into the head of the document
+ echo "";
+}
+add_action('wp_head', 'lcp_inject_breakpoints_to_frontend');
+
+
+
+// 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 '';
+}
+
+
+
+
+
+// The callback function to display the custom code inserterpage content
+function lcp_custom_code_inserter_page() {
+ // Get the stored options from wp_options
+ $custom_code = get_option( 'custom_code_options', array() );
+
+ ?>
+
+
Custom Code Settings
+
+
+ ' . $custom_code['js_header'] . '';
+ }
+
+ // 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
+
+
+ = headerHeight) {
- // Add the 'lcp-fixed' class and set 'top' to 0
+ // Add the 'lcp-fixed' class and set 'top' to 0 for side content
sideContent.classList.add('lcp-fixed');
sideContent.style.top = '0';
+
+ // If the header has 'lcp-sticky-on-scroll', adjust height of side content to be 100vh - fullHeaderHeight
+ if (isStickyOnScroll) {
+ sideContent.style.height = `calc(100vh - ${fullHeaderHeight}px)`;
+ // Add 'lcp-fixed' to the header
+ header.classList.add('lcp-fixed');
+ // Set the 'top' of the sideContent to the height of the header
+ sideContent.style.top = `${fullHeaderHeight}px`;
+ } else if (isSticky) {
+ // If the header is sticky but not 'sticky-on-scroll', keep the side content height adjusted
+ sideContent.style.height = `calc(100vh - ${fullHeaderHeight}px)`;
+ } else {
+ // Set side content height to 100vh when not sticky
+ sideContent.style.height = '100vh';
+ }
} else {
- // Remove the 'lcp-fixed' class if scrolled back above the header
+ // Remove the 'lcp-fixed' class from side content and header if scrolled back above the header
sideContent.classList.remove('lcp-fixed');
sideContent.style.top = ''; // Reset the 'top' style
+
+ // Reset height to 100vh when not fixed
+ sideContent.style.height = isSticky ? `calc(100vh - ${headerHeight}px)` : '100vh';
+
+ // If header has the 'lcp-sticky-on-scroll' class, remove 'lcp-fixed' from the header
+ if (isStickyOnScroll) {
+ header.classList.remove('lcp-fixed');
+ }
}
}
@@ -39,10 +79,6 @@ document.addEventListener('DOMContentLoaded', function () {
-
-
-
-
const sidecontent = document.getElementById("lcp-sidecontent");
const innerContent = document.getElementById("lcp-sidecontent-inner");
const scrollTrack = document.getElementById("lcp-scroll-track");
diff --git a/style.css b/style.css
index bae05c0..b647ecc 100644
--- a/style.css
+++ b/style.css
@@ -62,7 +62,7 @@ Version: 1.0
z-index: 3;
}
-#lcp-header-container.lcp-sticky-on-scroll.lcp-stuck {
+#lcp-header-container.lcp-sticky-on-scroll.lcp-fixed {
position: fixed;
top: 32px; /* Adjusted for admin bar, if present */
left: 0;
@@ -76,14 +76,8 @@ Version: 1.0
top: 32px; /* Adjust for admin bar visibility */
}
-#lcp-header-container.lcp-sticky-on-scroll {
- position: absolute;
- top: 0;
- left: 0;
- right: 0;
-}
-#lcp-header-container.lcp-sticky-on-scroll.lcp-stuck {
+#lcp-header-container.lcp-sticky-on-scroll.lcp-fixed {
position: fixed;
top: 32px; /* Adjusted if admin bar is visible */
}