• 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 widget area only above one page

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 widget area only above one page

This topic is: not resolved

Tagged: genesis_after_header

  • This topic has 16 replies, 2 voices, and was last updated 12 years, 2 months ago by Brad Dalton.
Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • November 6, 2013 at 8:20 pm #71370
    erickuhn19
    Member

    I am trying to register the widget area on my forum page just after the header or before the content (it can be said both ways). I only want this widget area to be shown on my forum page and any subpages of the forum.

    I posted the code below to make sure I was doing this correctly. Most of the info was received from Carriedils.com (http://www.carriedils.com/add-widget-area-below-nav/)

    Is this correct? Or is there an easier way to do this? (I am using the Agency-Pro theme.

    //* Register before forum
    genesis_register_sidebar( array(
    'id' => 'genesis_before_forum',
    'name' => __( 'Before Forum', 'agency-pro' ),
    'description' => __( 'This is a widget area that can be placed before the forum', 'agency-pro' ),

    add_action( 'genesis_after_header', 'agency_login_widget' );

    /**
    * Add login widget support for site. If widget not active, don't display
    *
    */
    function agency_login_widget() {

    // Don't display the login on the home page, since it's built into the agency-pro theme
    if ( is_home() ) {
    return;
    }

    // If it's the Forum page, display login widget
    elseif ( is_page( 'forum' ) ) {
    genesis_widget_area( 'agency_login_widget', array(
    'before' => '<div id="login"><div class="wrap">',
    'after' => '</div></div>',
    ) );

    }

    November 6, 2013 at 11:52 pm #71391
    Brad Dalton
    Participant


    Use this code and change the conditional tag from this?

    is_front_page()
    

    To:

    is_page ('007') 
    

    Replace the 007 with your page i.d

    You can also change the hook from:

    genesis_before_loop
    

    to:

    genesis_before_content_sidebar_wrap
    

    Tutorials for StudioPress Themes.

    November 7, 2013 at 5:52 pm #71571
    erickuhn19
    Member

    I'm not sure what happened but I am getting this error message:

    Parse error: syntax error, unexpected '(' in /home/content/85/11958585/html/wp-content/themes/agency-pro/functions.php on line 149

    And I cant get back into my WordPress editor at all...

    November 7, 2013 at 6:07 pm #71573
    erickuhn19
    Member

    Nevermind I figured out how to go into my hosting and edit the functions file from there.

    Can you tell what is wrong with my code that created that error

    <script src="https://github.com/erickuhn19/bbpress/blob/master/register%20widget%20in%20forum"></script>

    November 7, 2013 at 6:17 pm #71574
    erickuhn19
    Member

    Sorry I didn't post that right:

    genesis_register_sidebar( array(
    'id' => 'before-loop',
    'name' => __( 'Front Page Slider', 'wpsites' ),
    'description' => __( 'This is the slider widget.', 'wpsites' ),
    ) );

    add_action( 'genesis_before_loop', 'wpsites_before_loop_widget' );
    function wpsites_before_loop_widget() {
    if (is_page ('forum') && is_active_sidebar('before-loop') ) {
    genesis_widget_area( 'before-loop', array(
    'before' => '<div class="before-loop">',
    'after' => '</div>',
    ) );

    }}

    November 7, 2013 at 7:20 pm #71583
    Brad Dalton
    Participant

    Please copy the code from the view raw link and paste it at the end of your child themes functions.php file using a text editor like Notepad++

    add widget area only above one page

    I tested this code and it works.

    When you copy it from a web page, it turns the apostrophes (single qoutes) around causing an error.

    When you embed it in a web page, anyone that comes along and copies it will get an error.

    Please use Github gists to embed your code in a web page.


    Tutorials for StudioPress Themes.

    November 7, 2013 at 8:05 pm #71602
    erickuhn19
    Member

    I see thanks for the information. OK, I got my Github working.

    Is page ID /forum or do I have to assign a number custom fields?

    <script src="https://gist.github.com/erickuhn19/7364210.js"></script>

    November 7, 2013 at 8:23 pm #71608
    Brad Dalton
    Participant

    Either is fine. I tested forum and it works but didn't have your page i.d


    Tutorials for StudioPress Themes.

    November 7, 2013 at 9:36 pm #71615
    erickuhn19
    Member

    For some reason it is not working for me. Maybe because the bbpress forum is the content before it? Or something to do with the Agency-Pro theme.

    I have tried a few variations using your method as well as: http://www.carriedils.com/add-widget-area-below-nav/#comment-3320
    Both are similar but still a little different.

    Can you tell whats wrong with these?

    <p><script src="https://gist.github.com/erickuhn19/7365562.js"></script></p>

    <p><script src="https://gist.github.com/erickuhn19/7365906.js"></script></p>

    November 8, 2013 at 1:38 am #71636
    Brad Dalton
    Participant

    I didn't test with the page i.d because you haven't linked to it.

    I would suggest you use the page i.d.

    I have tested the code locally twice and it works so it must be the conditional tag.

    If you're using bbpress, you may want to post a question on thier forum.


    Tutorials for StudioPress Themes.

    November 9, 2013 at 4:22 pm #71904
    erickuhn19
    Member

    Brad,
    I want to thank you for all of your help. I just tested the code applying the widget to my "resources" page, so there must be a bug with this working with the bbpress.

    I really appreciate your help and patience.

    November 9, 2013 at 6:14 pm #71915
    Brad Dalton
    Participant

    I'll install bbpress and test it. I think you need to use the is_bbpress() conditional tag.

    Try this:


    Tutorials for StudioPress Themes.

    November 9, 2013 at 6:35 pm #71917
    Brad Dalton
    Participant

    So you only want to display this widget on one page of the bbpress forum correct?


    Tutorials for StudioPress Themes.

    November 10, 2013 at 2:55 pm #72110
    erickuhn19
    Member

    Brad,
    Yes! This worked!

    Thank you.

    November 10, 2013 at 8:00 pm #72215
    Brad Dalton
    Participant

    Good stuff.

    I'm still working out how to make it display on one specific page of bbPress.


    Tutorials for StudioPress Themes.

    November 10, 2013 at 8:39 pm #72225
    erickuhn19
    Member

    Cool, I actually prefer it showing up on every page of the forum, so this works grrat for me. My next step is customizing the background of the widget so it matches the forum.

    November 10, 2013 at 8:54 pm #72226
    Brad Dalton
    Participant

    Try this http://wpsites.net/web-design/style-widgets-individually-beginners-guide/

    You'll need to find the section i.d class for the widget using a tool like Google Chrome dev or Firebug and then add your background declaration:

    Example:

    #widget-i.d {
    background-color: red;
    }
    

    Tutorials for StudioPress Themes.

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