GeneratePress Conditional Sidebars in Taxonomy Archives with mb.get_sidebar()

Support MB Views GeneratePress Conditional Sidebars in Taxonomy Archives with mb.get_sidebar()

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #40988
    AMXAMX
    Participant

    Hi,

    I am building a site with GP, Meta Box and FacetWP. In the conditional sidebars I need filters generated by FacetWP.

    To create the loops for Taxonomy Archives, I must choose “Replace the layout between header and footer” from the View settings. This, however, deletes the sidebar.

    I have found out in the forum that adding {{ mb.get_sidebar() }} to the view adds the sidebar. But that only adds the default sidebar.

    Then something unexpected happened: I changed the Element settings to “right sidebar” and the block element appeared in the left sidebar… My layout is Sidebar/Content, so I am a little confused… The body class is “.left-sidebar” and the widget area class is “.is-right-sidebar”.

    Unfortunately, even accepting that “right is the new left” doesn’t work, because the element display conditions don’t work. I have so far 1 sidebar for taxonomy term archive 1 and another sidebar for taxonomy term 2. The second sidebar should completely replace the sidebar (Element Type: right sidebar), but what it does is it merges with first sidebar, as if it were “after right sidebar content”. So, it is not usable, the way it is now…

    Any ideas how I can make GeneratePress conditional sidebars work in Taxonomy Archives?

    Greetings,
    Tom

    #40995
    AMXAMX
    Participant

    Update: the sidebars no longer merge, it turned out the condition wasn't saved correctly.
    But still, the sidebars are not displayed in the right place. And I cannot have a dual sidebar setup. Changing the layout to Sidebar/Content/Sidebar enables only the Right Sidebar Area, and the left sidebar area is gone, although the body class is "both sidebars". I would like to have 2 sidebars on some archives...

    #41003
    PeterPeter
    Moderator

    Hello,

    You can use the function get_sidebar() to get many sidebars on a page as you want, just pass the sidebar name to the function. For example:

    get_sidebar( 'left-sidebar' )
    <content here>
    get_sidebar( 'right-sidebar' )

    please contact theme support to get the correct sidebar name. And read more on the documentation https://developer.wordpress.org/reference/functions/get_sidebar/

Viewing 3 posts - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.