[Resolved] Additional sidebars

Home Forums Support Additional sidebars

  • This topic has 5 replies, 3 voices, and was last updated 2 months ago by Leo.
Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1376576
    Romeo

    Hey guys! I can’t praise you enough for the GP. I switched from OceanWP to GeneratePress and got my WooCommerce site to load under 1 second. That’s, just wow!

    Anyway for the issue:

    There is a “right-sidebar” that I am using for the WooCommerce single products, using hook to display it. However, I would Like one more sidebar that I should display on the blogposts. What are the steps to add additonal sidebar?

    #1376750
    David
    Staff
    Customer Support

    Hi there,

    i would recommend using the Content Aware Sidebars plugin:

    https://en-gb.wordpress.org/plugins/content-aware-sidebars/

    #1376986
    Romeo

    Thank you for the reply. Is there not a way todo it without additional plugin?

    I tried adding following code to child function:

    add_action( 'widgets_init', 'singel_blog_post_sidebar' );
    function singel_blog_post_sidebar() {
      $args = array(
        'name'          => 'Single post',
        'id'            => 'single-sidebar',
        'description'   => 'Add content to single post sidebar',
        'class'         => 'right-sidebar',
        'before_widget' => '<aside id="%1$s" class="widget inner-padding %2$s">',
        'after_widget'  => '</aside>',
        'before_title'  => '<h2 class="widget-title">',
        'after_title'   => '</h2>' 
      );
    
      register_sidebar( $args );
    
    }

    Then using a hook to call for it using:

    <?php get_sidebar( 'single-sidebar'); ?>

    However, if I call it “get_sidebar” it just gets the right sidebar (i can’t even change it to left-sidebar, it always shows the right sidebar).

    Any ideas?

    #1376994
    Leo
    Staff
    Customer Support

    I wonder if you are able to use the new block element module to accomplish this:
    https://generatepress.com/gp-premium-1-11-0-block-elements/

    It’s currently in alpha testing though.

    If not the plugin would be the best way to go, otherwise you can try to inspect the code of the plugin to see how they did it.

    #1377275
    Romeo

    Alright, thanks for the explanation. Though I think it would be awesome to be able to put your own sidebars. Rarely you only use one (if you run WooCommerce).

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