Home › Forums › WoodMart support forum › How to Make Sticky All Headers
How to Make Sticky All Headers
- This topic has 3 replies, 2 voices, and was last updated 6 years, 10 months ago by Artem Temos.
Viewing 4 posts - 1 through 4 (of 4 total)
-
AuthorPosts
-
January 27, 2018 at 2:48 am #35577
dumdumtekParticipantHello
how to make sticky all headers? so when we scroll down, the header view remains the same
because in the default setting of woodmart, when we scroll down, the header shown is not all
January 27, 2018 at 9:39 am #35602
Artem TemosKeymasterHi,
Try to add the following PHP code snippet to the child theme functions.php file to change this behavior
function woodmart_body_class( $classes ) { $page_id = woodmart_page_ID(); $site_width = woodmart_get_opt( 'site_width' ); $cart_design = woodmart_get_opt( 'shopping_cart' ); $wishlist = woodmart_get_opt( 'header_wishlist' ); $header = woodmart_get_opt( 'header' ); $header_overlap_opt = woodmart_get_opt( 'header-overlap' ); $product_design = woodmart_product_design(); $product_sticky = woodmart_product_sticky(); $top_bar = woodmart_get_opt( 'top-bar' ); $ajax_shop = woodmart_get_opt( 'ajax_shop' ); $header_search = woodmart_get_opt( 'header_search' ); $ajax_search = woodmart_get_opt( 'search_ajax' ); $mobile_menu_position = woodmart_get_opt( 'mobile_menu_position' ); $hide_sidebar_mobile = woodmart_get_opt( 'shop_hide_sidebar' ); $hide_sidebar_tablet = woodmart_get_opt( 'shop_hide_sidebar_tablet' ); $hide_sidebar_desktop = woodmart_get_opt( 'shop_hide_sidebar_desktop' ); $catalog_mode = woodmart_get_opt( 'catalog_mode' ); $categories_toggle = woodmart_get_opt( 'categories_toggle' ); $logo_responsive = woodmart_get_opt( 'logo_responsive_sizes' ); $sticky_footer = woodmart_get_opt( 'sticky_footer' ); $dark = woodmart_get_opt( 'dark_version' ); $form_fields_style = ( woodmart_get_opt( 'form_fields_style' ) ) ? woodmart_get_opt( 'form_fields_style' ) : 'square'; $form_border_width = woodmart_get_opt( 'form_border_width' ); $menu_style = ( woodmart_get_opt( 'menu_style' ) ) ? woodmart_get_opt( 'menu_style' ) : 'default'; $header_dropdowns = ( woodmart_get_opt( 'header_dropdowns_dark' ) ) ? 'light' : 'dark'; $full_screen_menu = woodmart_get_opt( 'full_screen_menu' ); $header_overlap = $header_sticky = $disable_sticky = false; $disable = get_post_meta( $page_id, '_woodmart_title_off', true ); $classes[] = 'wrapper-' . $site_width; $classes[] = 'global-cart-design-' . $cart_design; $classes[] = 'global-search-' . $header_search; $classes[] = 'mobile-nav-from-' . $mobile_menu_position; $classes[] = 'form-style-' . $form_fields_style; $classes[] = 'form-border-width-' . $form_border_width; $classes[] = 'menu-style-' . $menu_style; $classes[] = 'dropdowns-color-' . $header_dropdowns; $classes[] = ( $full_screen_menu ) ? 'global-full-screen-menu' : ''; if( is_singular( 'product') ) { $classes[] = 'woodmart-product-design-' . $product_design; if( $product_sticky ) { $classes[] = 'woodmart-product-sticky-on'; } } $classes[] = ( $sticky_footer ) ? 'sticky-footer-on' : 'no-sticky-footer'; $classes[] = ( $dark ) ? 'woodmart-dark' : 'woodmart-light'; if( $catalog_mode ) { $classes[] = 'catalog-mode-on'; } else { $classes[] = 'catalog-mode-off'; } if( $categories_toggle ) { $classes[] = 'categories-accordion-on'; } else { $classes[] = 'categories-accordion-off'; } if( $wishlist != 'disable' ) { $classes[] = 'global-wishlist-enable'; } else { $classes[] = 'global-wishlist-disable'; } if( woodmart_is_blog_archive() ) { $classes[] = 'woodmart-archive-blog'; } else if( woodmart_is_shop_archive() ) { $classes[] = 'woodmart-archive-shop'; } else if( woodmart_is_portfolio_archive() ) { $classes[] = 'woodmart-archive-portfolio'; } if ( !woodmart_get_opt( 'header_close_btn' ) && woodmart_get_opt( 'header_banner' ) ) { $classes[] = 'header-banner-display'; } if ( woodmart_get_opt( 'header_banner' ) ) { $classes[] = 'header-banner-enabled'; } if( $top_bar && !get_post_meta( $page_id, '_woodmart_top_bar_off', true ) ) { $classes[] = 'woodmart-top-bar-on'; }else { $classes[] = 'woodmart-top-bar-off'; } if( $top_bar && woodmart_get_opt( 'top_bar_right_text' ) != '' ) { $classes[] = 'woodmart-top-bar-mobile-on'; } else { $classes[] = 'woodmart-top-bar-mobile-off'; } if( $ajax_shop ) { $classes[] = 'woodmart-ajax-shop-on'; } else { $classes[] = 'woodmart-ajax-shop-off'; } if( $ajax_search ) { $classes[] = 'woodmart-ajax-search-on'; } else { $classes[] = 'woodmart-ajax-search-off'; } $classes[] = ( $logo_responsive ) ? 'logo-responsive-on' : 'logo-responsive-off'; if( $hide_sidebar_mobile ) { $classes[] = 'offcanvas-sidebar-mobile'; } if( $hide_sidebar_tablet ) { $classes[] = 'offcanvas-sidebar-tablet'; } if( $hide_sidebar_desktop ) { $classes[] = 'offcanvas-sidebar-desktop'; } if( woodmart_get_opt('sticky_header') ) { $classes[] = 'enable-sticky-header'; $header_sticky = true; } else { $disable_sticky = true; $classes[] = 'disable-sticky-header'; } if( is_singular( 'product') && woodmart_get_opt('single_full_width') ) { $classes[] = 'header-full-width'; } if( woodmart_get_opt('header_full_width') ) { $classes[] = 'header-full-width'; } if( in_array( $header, array('menu-top') ) ) { $header_sticky = false; $classes[] = 'sticky-navigation-only'; } else if( in_array( $header, array('base', 'simple', 'logo-center', 'categories') ) ) { $header_sticky = 'clone'; } $classes[] = 'woodmart-header-' . $header; if( $header == 'shop' || $header == 'split' ) { $header_sticky = 'real'; if( $header_overlap_opt ) { $header_overlap = true; } } if( $header == 'simple' && $header_overlap_opt ) { $header_overlap = true; $header_sticky = 'real'; } if( $header_overlap ) { $classes[] = 'woodmart-header-overlap'; } $classes[] = 'sticky-header-real'; $classes = array_merge( $classes, woodmart_get_buttons_config_classes() ); return $classes; } add_filter('body_class', 'woodmart_body_class');
January 27, 2018 at 9:44 am #35603
dumdumtekParticipantthanks … it works fine 😀
January 27, 2018 at 9:47 am #35606
Artem TemosKeymasterGreat, you are welcome!
-
AuthorPosts
Tagged: sticky header
Viewing 4 posts - 1 through 4 (of 4 total)
- You must be logged in to create new topics. Login / Register