• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

Adding different sidebar to a template

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › Adding different sidebar to a template

This topic is: not resolved

Tagged: Page Templates, registering sidebar widget, sidebars

  • This topic has 3 replies, 3 voices, and was last updated 10 years, 10 months ago by lcrand.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • February 1, 2015 at 2:48 pm #139313
    lcrand
    Member

    I am using the Epik theme from Genesis
    http://development.fers-route-to-retirement.com/free-articles/

    The theme comes with a primary (right) and secondary (left) sidebar but I want to create a template page for a certain section of the site that just has a secondary sidebar.

    1. I created a template - page_lessons.php

    2. I registered a new sidebar widget in the child functions file using this code:

    //* Register lessons sidebar widget area
    genesis_register_sidebar( array(
    'id' => 'lessons',
    'name' => __( 'Lessons Page', 'Epik' ),
    'description' => __( 'This is a sidebar widget area for the lessons pages', 'Epik' ),
    ) );

    3. I created a new sidebar_lessons.php file and put this in it:

    <div id="sidebar" class="sidebar widget-area">
    <?php
    genesis_structural_wrap( 'sidebar' );
    do_action( 'genesis_before_sidebar_widget_area' );
    dynamic_sidebar('lessons-sidebar');
    do_action( 'genesis_after_sidebar_widget_area' );
    genesis_structural_wrap( 'sidebar', 'close' );
    ?>
    </div>

    4. This is where I think I went wrong:
    I added this code to the page_lessons.php file:

    <?php

    // Template Name: Lessons

    add_action( 'get_header', 'child_sidebar_logic' );
    /**
    * Swap in a different sidebar instead of the default sidebar.
    *

    */
    function child_sidebar_logic() {
    if ( is_page_template( 'page_lessons.php' ) )
    {
    remove_action( 'genesis_before_sidebar_widget_area', 'genesis_get_sidebar' );
    add_action( 'genesis_before_sidebar_widget_area', 'child_get_lessons-sidebar' );
    }
    {
    remove_action( 'genesis_after_content', 'genesis_get_sidebar' )
    }
    }

    /**
    * Retrieve blog sidebar
    */
    function child_get_lessons() {
    get_sidebar( 'lessons-sidebar' );
    }

    genesis();

    5. On the page I am using to test it, it is still showing the regular secondary sidebar from the original sidebar widget. It did remove the primary sidebar, as I wanted, but the content area is still as narrow as though there is a sidebar there. I get confused about naming conventions with this stuff - is that my problem? Or is there something else wrong?

    http://development.fers-route-to-retirement.com/free-articles/
    February 2, 2015 at 12:08 am #139340
    WisdmLabs
    Member

    Hi,

    You could use a filter to force a layout on the template. Genesis has 6 default layouts.

    Refer this link
    http://genesissnippets.com/force-a-layout/


    http://wisdmlabs.com/

    February 2, 2015 at 2:04 am #139347
    Genesis Developer
    Member

    try the Genesis Simple Sidebar Plugins once.


    Download Genesis Featured Posts Combo Widget | Simple Grid Layouts Plugin for Posts, CPTs and terms
    You can request new tips/help.

    February 2, 2015 at 6:34 pm #139457
    lcrand
    Member

    WisdmLabs-

    That worked great for getting the secondary sidebar to show up, but any leads on getting it to call in the new sidebar widget? It's still calling in the main one...

  • Author
    Posts
Viewing 4 posts - 1 through 4 (of 4 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble