Home › Forums › WoodMart support forum › Sticky product just on one page
Sticky product just on one page
- This topic has 5 replies, 2 voices, and was last updated 6 years, 10 months ago by
Elise Noromit.
-
AuthorPosts
-
April 30, 2018 at 7:42 pm #55468
nephyhlimParticipantHi
is there a way to have Sticky product just on one product page and not on others?
Thanks in advance!
April 30, 2018 at 8:24 pm #55475
Elise NoromitMemberHello,
We can try to do it with CSS. Please send the link for the product as well as the screen, what part of the content you want to stick.
Best Regards
April 30, 2018 at 8:27 pm #55476
nephyhlimParticipantThat would be https://www.cociparties.de/produkt/individuelle-girlande-erstellen-mit-texteditor/ and then just the productcimage sticky, as it would be if you turn on the sticky product option in theme settings, but i only need it on this page, thx
May 1, 2018 at 6:48 am #55504
Elise NoromitMemberHello,
Please add this PHP snippet to the child theme.
function woodmart_body_class( $classes ) { $page_id = woodmart_page_ID(); $site_width = woodmart_get_opt( 'site_width' ); $product_design = woodmart_product_design(); $product_sticky = woodmart_product_sticky(); $ajax_shop = woodmart_get_opt( 'ajax_shop' ); $ajax_search = woodmart_get_opt( 'search_ajax' ); $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' ); $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'; $full_screen_menu = woodmart_get_opt( 'full_screen_menu' ); $header_overlap = $header_sticky = $disable_sticky = false; $classes[] = 'wrapper-' . $site_width; // Form style settings $classes[] = 'form-style-' . $form_fields_style; $classes[] = 'form-border-width-' . $form_border_width; $classes[] = ( $full_screen_menu ) ? 'global-full-screen-menu' : ''; if( is_singular( 'product' ) ) { $classes[] = 'woodmart-product-design-' . $product_design; if( $product_sticky || get_the_ID() == 51 ) { $classes[] = 'woodmart-product-sticky-on'; woodmart_enqueue_script( 'woodmart-sticky-kit' ); } } if ( woodmart_woocommerce_installed() && ( is_shop() || is_product_category() ) && ( $hide_sidebar_desktop && $sticky_footer ) ) { $classes[] = 'no-sticky-footer'; }elseif( $sticky_footer ){ $classes[] = 'sticky-footer-on'; } $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( 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'; } //Header banner 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( $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'; } if( $hide_sidebar_mobile ) { $classes[] = 'offcanvas-sidebar-mobile'; } if( $hide_sidebar_tablet ) { $classes[] = 'offcanvas-sidebar-tablet'; } if( $hide_sidebar_desktop ) { $classes[] = 'offcanvas-sidebar-desktop'; } $classes = array_merge( $classes, woodmart_get_buttons_config_classes(), woodmart_get_header_body_classes() ); return $classes; } add_filter('body_class', 'woodmart_body_class');
Then insert the ID of the product which you want to make sticky in this place of the code: http://prntscr.com/jc94jg
Best Regards
May 1, 2018 at 8:49 am #55533
nephyhlimParticipantwow, thx for the elaborate reply. However that is a lot of code and I dont know how to create child theme. I thought this would be somehow easier to implement.
May 1, 2018 at 9:33 am #55539
Elise NoromitMemberHello,
1/ Login into your ThemeForest account, download child theme, install and activate it. All your parent theme settings would remain the same.
2/ Go to Appearance > Editor http://prntscr.com/jcagzo add the snippet to functions.php file
3/ Find the place on the screen provided above and insert there ID of the product.
In order to see the product ID enter its editing mode and you will see in url.
Best Regards
-
AuthorPosts
- You must be logged in to create new topics. Login / Register