[Resolved] left sidebar on WC shop page and no sidebars on single product pages

Home Forums Support [Resolved] left sidebar on WC shop page and no sidebars on single product pages

Home Forums Support left sidebar on WC shop page and no sidebars on single product pages

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #657733
    Daan van

    Hi Leo and Tom,

    I would like the WC shop page sidebar on the left and the single product pages with no sidebar.

    I’ve succeeded in getting the left sidebar on the shop page with a snippet on a different thread on this page:

    add_filter( ‘generate_sidebar_layout’,’generate_custom_woocommerce_sidebar_layout’ );
    function generate_custom_woocommerce_sidebar_layout( $layout )
    {
    // If we are on a woocommerce page, set the sidebar
    if ( is_woocommerce() )
    return ‘left-sidebar’;
    // Or else, set the regular layout
    return $layout;
    But I haven’t found out yet how to get the single product pages to show no sidebar.
    On my other site, http://www.cribster.nl, the page specific layout options do work for single product pages and the shop page, which is kinda strange.
    For example product page:
    https://www.wiegenco.nl/winkel/merken/snuz/snuzpod3/
    For shop page:
    https://www.wiegenco.nl/winkel/
    I’ve put the website on visible for the time being so you can take a look, it is still a work in progress.
    How can I fix this and how can it be that those options do work for my previous site, but not for the latest one?
    Thank you for your help again!

    GeneratePress 2.1.4
    GP Premium 1.7.2
    #657764
    Daan van

    One additional thing:

    I used to be able to make the sidebar and header responsive by adding:


    @media
    (min-width: 769px) {.inside-header {display: none;}
    }


    @media
    (max-width: 769px) {.sidebar .widget {display: none;}
    }

    But on the new site, the .inside-header will not only delete the header, but also the primary navigation. It seems like the header and navigation are now integrated into one. What am I doing different/wrong?

    #657833
    David
    Staff
    Customer Support

    Hi there,

    you may want to use the new Elements module, which has Display rules for Layout (headers and hooks):

    https://docs.generatepress.com/article/layout-element-overview/

    The Nav is set to Float Right so ends up inside the header hence it being removed. Have you thought of using the Mobile Header instead?

    #661401
    Daan van

    Thanks David! And I think I found the culprit, thanks for all the help!

    #661483
    David
    Staff
    Customer Support
Viewing 5 posts - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.