[Support request] Create a custom sidebar for archives pages

Home Forums Support [Support request] Create a custom sidebar for archives pages

Home Forums Support Create a custom sidebar for archives pages

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #1092948
    Hilton

    Hi,

    I’d like to know how can I create a new sidebar to use only in archives pages.

    Thanks

    #1093358
    Leo
    Staff
    Customer Support

    Hi there,

    This plugin should help:
    https://en-ca.wordpress.org/plugins/content-aware-sidebars/

    Let me know 🙂

    #1093369
    Hilton

    Hi Leo,

    I don’t want to install a plugin.

    #1093371
    Leo
    Staff
    Customer Support

    Then unfortunately you will need a custom solution.

    That plugin is what we always suggest for requests like this.

    #1093397
    Hilton

    I was thinking about doing the following:

    Register a new sidebar:

    if ( function_exists('register_sidebar') ) {
    	register_sidebar(array(
    		'name' => 'New Sidebar',
    		'id' => 'new-sidebar',
    		'description' => 'New Sidebar',
    		'before_widget' => '<li id="%1$s">',
    		'after_widget' => '</li>',
    		'before_title' => '<h2>',
    		'after_title' => '</h2>',
    	));
    }

    2. Duplicate archive.php and rename to category.php.

    3. Substitute generate_construct_sidebars(); for the following:

    <?php if ( is_active_sidebar( 'new-sidebar' ) ) : ?>
        <div class="sidebar new-sidebar">
            <?php dynamic_sidebar( 'new-sidebar' ); ?>
        </div>
    <?php endif; ?>

    Do you think that will work?

    #1093404
    Leo
    Staff
    Customer Support

    Feel free to give it a shot.

    Using the plugin might be an easier solution. Have you tried it?

    It might not impact your site speed at all.

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