• 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

Add a Widget to 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 › Add a Widget to Page Template

This topic is: not resolved

Tagged: adding widgets, Page Templates, widgets

  • This topic has 4 replies, 3 voices, and was last updated 10 years, 6 months ago by LeaChristine.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • July 27, 2015 at 1:44 pm #160612
    LeaChristine
    Member

    Hi there, I have a question about displaying a widget area only on pages that have a given page template assigned to them. Can someone please help me with this, and let me know if it's even possible?

    I have a slider that I want to display *only* on my site's About Page-- however, I'm also using Advanced Custom Fields for the About page's content area, so I need to create a page template for it. But when I assign the About template to the About page, my slider disappears. Here is the code I have so far trying to get this to work:

    functions.php code:

    //* Register widget for SLIDER
    genesis_register_sidebar( array(
    	'id'          => 'slider',
    	'name'        => __( 'Slider Area' ),
    	'description' => __( 'This is the area where the slider is displayed' ),
    ) );
    

    about.php code:

    <?php
    /**
     * Template Name: About Page
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>
    
    <?php
    
    //* Hook social widget area in header
    add_action( 'genesis_before_content', 'slider');
    function slider() {
    
    // If it's the About page, display slider
    
    if (is_page( 'about' ) ) {
     
    	genesis_widget_area( 'slider', array(
    		'before' => '<div class="slider">',
    		'after'  => '</div>',
    	) );
     
    }
    
    }
    
    ?>
    
    <div class="content">
    <div class="entry">
    
    <?php if ( have_rows('story_title') ):
    	while ( have_rows('story_title') ): the_row(); ?>
    	
    	               <h3><?php the_field('story_title'); ?></h3>
    					
    		<?php endwhile;
    endif; ?>	
    
    </div><!-- #entry -->
    		</div><!-- #content -->
    
    <?php get_footer(); ?>

    I have already tried registering the widget in only the functions.php, and only in the about.php. Neither approaches are working. Any help you can give me would be much appreciated. Thanks!

    http://sample.leachristinedesigns.com/about/
    July 27, 2015 at 4:54 pm #160634
    Christoph
    Member

    Hi,

    you are not calling genesis(); on the template, so all the Genesis goodness, like genesis hooks or widget areas won't be available.

    If you want to stay outside of Genesis and your slider provides a short code (like soliloquy) you can include it that way on the template.

    Here is an example of how Mike Hemberger is including ACF in a "genesis" template:

    Front End Post Editing with Advanced Custom Fields Pro


    https://www.christophherr.com | Genesis Customizations | Buy me a coffee

    July 28, 2015 at 7:00 am #160726
    LeaChristine
    Member

    Ok, so this is really weird, but I added

    <?php genesis (); ?>

    right after the

    <?php
    /**
     * Template Name: About Page
     *
     * @package WordPress
     * @subpackage Twenty_Fourteen
     * @since Twenty Fourteen 1.0
     */
    
    get_header(); ?>

    in my about.php, and now the slider is showing up where I want it to, but all the ACF content that was located in my entry-content is now sitting below the footer??

    http://sample.leachristinedesigns.com/about/

    July 28, 2015 at 7:14 am #160730
    coralseait
    Member

    Generally your Genesis call should be the last line


    Coral Sea IT

    July 28, 2015 at 7:22 am #160731
    LeaChristine
    Member

    I just cut and paste the

    <?php genesis (); ?>

    to the very end of my about.php, so right after the

    <?php get_footer(); ?>

    but now the slider and entry content is under the footer.. sorry, I guess I'm not understanding the exact way I should format the code so that the Genesis loop is included with ACF integrated into it?

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