• 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 a widget above the page title on certain pages

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 a widget above the page title on certain pages

This topic is: not resolved

Tagged: above title, widgets

  • This topic has 8 replies, 3 voices, and was last updated 12 years, 1 month ago by oiseau73.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • July 21, 2014 at 3:16 pm #115255
    oiseau73
    Member

    Hi there,

    Here's the site: http://dow.us/

    In the navigational sections that can be found on the left sidebar (here's an example: http://dow.us/dow-managed-portfolios/ ) there are links and green icons before the start of the page's content but below the page's title. The client now wants to have the icon section above the page's title. The icons and links are different in each section and the pages that are accessed by the top nav have no icon/links area at all. My thought was to create widgets for each of those sidebar sections, which I have, but then I am stuck. Would I create a page template for each section? What do I add to the functions.php file to pop those widgets above the titles? Or would I leave the functions.php alone and add things to each page template?

    Thanks!

    Suzy

    http:// http://dow.us/
    July 21, 2014 at 3:58 pm #115258
    Brad Dalton
    Participant

    The icons and links are different in each section

    How many times will they be different?


    Tutorials for StudioPress Themes.

    July 22, 2014 at 8:07 am #115362
    oiseau73
    Member

    Hi Brad,

    The different sections are:
    Portfolio Review
    Overview
    Client Services
    Managed Portfolios
    Fixed Income
    Corporate Retirement
    Institutional Investing
    Investor Education
    Advertising

    I am guessing that each of those sections would need a page template? I can add a widget for each section and add the code for the icons/links in there. What I need help with is what code with what genesis hooks I would add for each template.

    Thanks!

    July 22, 2014 at 10:23 am #115398
    Brad Dalton
    Participant

    You add a conditional tag after the functions for the widgets from your functions file or hard code them into a template. http://wpsites.net/web-design/adding-new-widget-areas-in-studiopress-themes/

    Hooks

    genesis_before_entry
    genesis_entry_header


    Tutorials for StudioPress Themes.

    July 22, 2014 at 2:10 pm #115445
    oiseau73
    Member

    Oh boy, I have spent the past hour making a fine mess! Fortunately, there is a demo version of the site (whew) and I have been trying to add in the Managed Portfolios widget to this page:
    http://bft-int.com/wp-demo1/dow-managed-portfolios/

    I like the idea of using a conditional tag, but I have to tell you, I haven't a clue as to what I am doing. Starting with the code from your post:

    add_action( 'genesis_after_header', 'your_widget' );
    function your_widget() {
    if ( is_front_page() && is_active_sidebar('new-widget') ) {
    genesis_widget_area( 'new-widget', array(
    'before' => '<div class="new-widget widget-area">',
    'after'	 => '</div>',
    		) ); 
     
      }
     
    }

    I have been trying different things:

    add_action( 'genesis_before_entry', 'managed-portfolios' );
    function genesis_entry_header() {
    if ( is_page( 407 )  && is_active_sidebar('managed-portfolios') ) {
    genesis_widget_area( 'managed-portfolios', array(
    'before' => '<div class="content-column">',
    'after'	 => '</div>',
    		) ); 
     
    }

    Which does not work. 🙂

    This line:
    if ( is_page( 407 ) && is_active_sidebar('managed-portfolios') ) {
    is trying to assign this sidebar to just page ID 407 which is the Managed Portfolio page.

    This line:
    'before' => '<div class="content-column">',
    "content-column" is the div the icons & links are sitting in.

    Guidance would be appreciated! Obviously, programming is not something I attempt very often.

    Thanks!

    July 22, 2014 at 5:13 pm #115458
    Brad Dalton
    Participant

    It doesn't work because you have missed part of the code.

    The first part of my code registers the widget which you have not used.


    Tutorials for StudioPress Themes.

    July 23, 2014 at 7:01 am #115377
    McGuive7
    Member

    Hi Suzy,

    I think you're on the right track with widget areas. If you needed different output on a per-page basis, then I would recommend implementing custom fields, however widget areas will work better for content that's shared across pages in specific sections. Anyhow, here's the solution I've implemented for this type of functionality on previous projects:

    1. Create your widget area. Sounds like you've done this already.
    2. It looks like the content is essentially mimicking the menu structure, so you could use a plugin like Simple Section Navigation. Not sure if that's what you're going for. Either way, add you content-specific widgets to the new widget area.
    3. Use a plugin like Widget Context or Widget Logic to control where the widgets display. This will allow you to output specific content on specific sections of your site, either via url pattern matching, or custom PHP logic. This will be dictated by how your different sections are defined. If they are just based on your page structure, then Widget Context and URL matching should work well.
    4. Output the widget area on whichever action hook works best for the location you want. Based on what you've described and the current layout of the site, it looks like genesis_entry_header should work well (the Genesis Visual Hook Guide is a great resource to figure this out). One thing to mention is that you'll likely want to add an if ( is_singular() ) conditional to make sure the widget isn't output on posts on archive/search/etc pages.

    So that's the top-level view of what I've done. Let me know if you need more specifics or have any questions. Best of luck!

    July 23, 2014 at 7:41 am #115503
    oiseau73
    Member

    Hi Brad,

    Sorry I left that out. This is what I have to register the widget:

    genesis_register_sidebar( array(
    	'id'          => 'managed-portfolios',
    	'name'        => __( 'Managed Portfolios', 'metro' ),
    	'description' => __( 'Managed Portfolio links.', 'metro' ),
    ) );

    Thanks, McGuive7, I will take a look at those plugins.

    July 27, 2014 at 12:29 pm #115384
    McGuive7
    Member

    Hi Suzy,

    I think you're on the right track with widget areas. If you needed different output on a per-page basis, then I would recommend implementing custom fields, however widget areas will work better for content that's shared across pages in specific sections. Anyhow, here's the solution I've implemented for this type of functionality on previous projects:

    1. Create your widget area. Sounds like you've done this already.
    2. It looks like the content is essentially mimicking the menu structure, so you could use a plugin like Simple Section Navigation. Not sure if that's what you're going for. Either way, add you content-specific widgets to the new widget area.
    3. Use a plugin like Widget Context or Widget Logic to control where the widgets display. This will allow you to output specific content on specific sections of your site, either via url pattern matching, or custom PHP logic. This will be dictated by how your different sections are defined. If they are just based on your page structure, then Widget Context and URL matching should work well.
    4. Output the widget area on whichever action hook works best for the location you want. Based on what you've described and the current layout of the site, it looks like genesis_entry_header should work well (the Genesis Visual Hook Guide is a great resource to figure this out). One thing to mention is that you'll likely want to add an if ( is_singular() ) conditional to make sure the widget isn't output on posts on archive/search/etc pages.

    So that's the top-level view of what I've done. Let me know if you need more specifics or have any questions. Best of luck!

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