• 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

Registered widget not showing up on page 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 › Registered widget not showing up on page template

This topic is: not resolved

Tagged: Page Templates, registering widget area, widgets

  • This topic has 11 replies, 3 voices, and was last updated 10 years, 11 months ago by WhiteleyDesigns.
Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • March 9, 2015 at 10:35 am #143813
    bibliofille
    Member

    Hello! I created a child theme to edit the main Genesis framework for a site I'm building.

    I registered 4 different widget areas, one for each new page template I created. I successfully registered each widget, and one shows up correctly on the page template, but the other three do not. I followed the same method for all 4, so I'm not sure what I'm missing.

    Here's how I registered the widget, in functions.php:

    //* Register widget areas
    genesis_register_sidebar( array(
        'id'          => 'sidebar-about',
        'name'        => __( 'About Sidebar', 'kim-schwede' ),
        'description' => __( 'This is a widget area for the about page.', 'kim-schwede' ),
    ) );

    Here's the sidebar-about.php include file I created:

    <?php
    /**
     *
     * @package Kim Schwede
     *
     */
    
    <div class="sidebar widget-area"></div>
    
    genesis_structural_wrap( ‘sidebar’ );
    
    do_action( ‘genesis_before_sidebar_widget_area’ );
    
    dynamic_sidebar(‘sidebar-about’);
    
    do_action( ‘genesis_after_sidebar_widget_area’ );
    
    genesis_structural_wrap( ‘sidebar’, ‘close’ );
    
    ?>
    
    </div>


    Here's what I put in the page-about.php page template, just after "get_header":

    <?php dynamic_sidebar( 'sidebar-about' ); ?>

    I did all this and it worked fine. Then I replicated the same method to create a widget for the page-design.php template. The widget is registered, however, the content doesn't show up on the page template. I changed everything that was "sidebar-about" to "sidebar-design" and put <?php dynamic_sidebar( 'sidebar-design' ); ?> in the page template, but it won't show up.

    Any help would be much appreciated!

    March 9, 2015 at 5:43 pm #143850
    Brad Dalton
    Participant

    Thats not really the best code to use. This is how i do it http://wpsites.net/web-design/widget-genesis/

    You can call the widget from each template

    or

    Call them using conditional tags from your functions file:

    Example:

    if ( is_page_template('your-template-name'))
    

    Tutorials for StudioPress Themes.

    March 9, 2015 at 7:02 pm #143856
    bibliofille
    Member

    I got it to work by changing the template file names; I was messing up the template hierarchy.

    What's wrong with the method I was using? I ask because I'm a new developer and still learning the best way to do things.

    March 9, 2015 at 7:18 pm #143860
    WhiteleyDesigns
    Member

    Maybe post the entire code from your page templates so we can see it. As Brad describes, you shouldn't need an about-sidebar.php based on what you're describing since you're pulling in a registered widget directly in the page template.

    Or as Brad described...you should include the sidebar.php file, but inside of that wrap each widget call in a conditional statement to pull based on the page template.


    Matt Whiteley – WhiteleyDesigns, GitHub
    Designing, Developing & Creating with WordPress

    March 9, 2015 at 9:24 pm #143875
    bibliofille
    Member

    Here's what's in the about page template, called "page-about.php":

    <?php
    /**
     * Template Name: About Page
     *
     * A custom page template for the about page.
     *
     * @package Kim_Schwede
     */
    
    get_header(); ?>
    
     <?php dynamic_sidebar( 'sidebar-about' ); ?>
    
    <?php genesis(); ?>
    
    <?php get_footer(); ?>
    March 11, 2015 at 7:56 am #144004
    WhiteleyDesigns
    Member

    So do you have a design page template as well (like page-design.php)? It should look something like this:

    <?php
    /**
     * Template Name: Design Page
     *
     * A custom page template for the about page.
     *
     * @package Kim_Schwede
     */
    
    get_header(); ?>
    
     <?php dynamic_sidebar( 'sidebar-design' ); ?>
    
    <?php genesis(); ?>
    
    <?php get_footer(); ?>

    And then, of course, you would need to select that page template when editing the page in WordPress.


    Matt Whiteley – WhiteleyDesigns, GitHub
    Designing, Developing & Creating with WordPress

    March 11, 2015 at 8:49 am #144008
    bibliofille
    Member

    Yes, that's correct. I actually had to change "page-design.php" to just "design.php". And I have a page template for a reviews page that's saved as "reviews.php". It didn't work when I had it saved as "page-reviews.php".

    So you're saying that I can either call the sidebar directly in the page template or have a "sidebar.php" file and call it in "functions.php" with a conditional, but I don't need to do both?

    March 11, 2015 at 9:26 am #144010
    WhiteleyDesigns
    Member

    Hmm...that's a bit odd that you had to change the page names to get it to work - that shouldn't make a difference.

    Anyhow, yes, you'll want to call the sidebar directly in the page template OR you'll want to use the sidebar.php and use conditionals. You'll need to include the sidebar.php file in the page template somewhere, then in the sidebar.php you can use conditionals based on what you want to show on specific page templates.

    I hope that makes sense...


    Matt Whiteley – WhiteleyDesigns, GitHub
    Designing, Developing & Creating with WordPress

    March 11, 2015 at 9:34 am #144015
    bibliofille
    Member

    Yes, that does make sense! Thanks for clarifying!

    I read in the Codex that naming a page template "page-xyz" causes WordPress to view it as a specialized page template.

    Here is the link: It's under the section "File Names."

    I took this to mean that I couldn't have "page-about.php", "page-design.php", "page-reviews.php", etc in my child theme directory. That seemed to be true because when I did it that way, WP recognized that there was a custom page template, but wouldn't use it when I selected it from the page WYSIWYG editor.

    I actually kept "page-about.php" but changed everything else to "design.php" and so forth and it worked, so that must have had something to do with it.

    March 11, 2015 at 9:35 am #144016
    bibliofille
    Member

    Here's the link:

    March 11, 2015 at 9:36 am #144017
    bibliofille
    Member

    Ok, here's the link: http://codex.wordpress.org/Page_Templates#Specialized_Page_Template

    March 11, 2015 at 9:42 am #144018
    WhiteleyDesigns
    Member

    Ahh...I always use page_customname.php - I use an underscore, not a hyphen. That makes sense. Same as when I do a custom archive or single page is is always single-customname.php or archive-customname.php.

    So - if you want to have the word page in front you could use an underscore instead and do page_design.php.


    Matt Whiteley – WhiteleyDesigns, GitHub
    Designing, Developing & Creating with WordPress

  • Author
    Posts
Viewing 12 posts - 1 through 12 (of 12 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

© 2026 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