• 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 above content on Streamline 2.0.1

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 above content on Streamline 2.0.1

This topic is: not resolved

Tagged: slider, widget, widget area

  • This topic has 14 replies, 3 voices, and was last updated 10 years, 6 months ago by swansonwc.
Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • March 7, 2013 at 12:56 pm #24822
    swansonwc
    Member

    Hi,

    I'm moving my wife's site to WordPress using the Streamline child theme. I'd like to be able to add an image slider above the content, and have it look similar to Streamline 1.0.1 - I did another site with that theme a little over a year ago http://motivational-speakers-review.com.

    I've been digging through the tutorials and the forum, but I'm not getting any result. I've added the following code to the functions.php page (in the Streamline child directory):

    genesis_register_sidebar( array(
    'id' => 'home-page-slider',
    'name' => __( 'Home Page Slider', 'streamline' ),
    'description' => __( 'This is a widget area that holds a picture slideshow on the homepage', 'streamline' ),
    ) );

    This has given me a new widget area in the admin panel.

    From one of Brad Dalton's answers in the forum, I added this code to my home.php file:

    /**
    * Display image slider on home page above content.
    *
    */
    add_action( 'genesis_before_content', 'child_before_content');
    function child_before_content() {
    if ( is_home() ) {
    echo '<div id="home-page-slider">';
    dynamic_sidebar( 'home-page-slider' );
    echo '</div><!-- end #home-page-slider -->';
    }
    }

    I added a widget to the new area, but it doesn't show up. I'm not a php or WordPress programmer, so I'm just hacking here. I'd appreciate any advice on where I'm going wrong. The site I'm working on is: http://75.103.78.29/~kellyswa/

    On the motivational-speakers-review site I used the dynamic content gallery plugin. I noticed that there are several other image slider plugins now available for the Genesis framework. Are there any advantages to the other sliders?

    Best regards,

    Bill

    March 7, 2013 at 6:35 pm #24903
    Brad Dalton
    Participant

    Hi Bill

    1. Sorry to hear you have problems with the code.

    That code has been copied and pasted incorrectly resulting in errors.

    Please refer to FAQ No.5 for help on how to post code snippets in this forum http://www.studiopress.community/faq/

    Its best practice to copy the raw version of the code and paste it into your functions.php file using a text editor like Notepad++ otherwise you may get an error.

    Exactly which genesis_hook do you want to use? http://genesistutorials.com/visual-hook-guide/

    Home page only or all pages? Any conditional tags you want to use with the code http://codex.wordpress.org/Conditional_Tags

    Try the raw version of this code https://gist.github.com/braddalton/5060622

    or this https://gist.github.com/braddalton/5047932

    or this http://pastebin.com/7S31KHym

    I have tested all these locally using the Streamline theme and they all work perfectly.

    2. I suggest you use the Genesis Responsive Slider plugin or Easing Slider.

    Please let me know if you have any further problems you need help with.

    Thanks.


    Tutorials for StudioPress Themes & WooCommerce.

    March 7, 2013 at 8:32 pm #24919
    swansonwc
    Member

    Brad,

    That's outstanding. Thank you!

    Yeah, I figured I had put the code in wrong. I'll use your suggestions in the morning and get back with you on the results.

    Best regards,

    Bill

    March 7, 2013 at 8:52 pm #24923
    micki
    Participant

    Hi, Following this and I am confused as to where I would put the conditional tags to have a widget before content be only on the home page.

    Do I add it to this and how exactly? I am challenged this way :).

    In child functions:

    add_action( 'genesis_before_loop', 'child_before_posts_sidebar' );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {

    echo '<div class="before-posts-sidebar">';
    dynamic_sidebar( 'before-posts-sidebar' );
    echo '</div>';

    }

    thanks for any help you can provide.

    March 7, 2013 at 9:02 pm #24925
    Brad Dalton
    Participant

    Place this code at the end of your child thems functions.php file https://gist.github.com/braddalton/5060622

    Copy the raw code version and paste it in your child themes functions.php file using a text editor like Notepad++


    Tutorials for StudioPress Themes & WooCommerce.

    March 7, 2013 at 9:41 pm #24927
    micki
    Participant

    Thank you! Just wanting to make sure I have this correct before I add it.

    add_action( 'genesis_before_loop', 'child_before_posts_sidebar' );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {
    if ( is_home() ) {

    echo '<div class="before-posts-sidebar">';
    dynamic_sidebar( 'before-posts-sidebar' );
    echo '</div>';
    }

    }

    basically I am just adding the if ( is_home() )

    March 8, 2013 at 12:27 am #24941
    Brad Dalton
    Participant

    Add all the code from that link Micki


    Tutorials for StudioPress Themes & WooCommerce.

    March 8, 2013 at 1:27 am #24950
    micki
    Participant

    I probably need to clarify that I am not using it for a slider, I am using it for text only. I apologize for not being more specific. Here is what is working BUT it is on all pages and I only need it for the home page. Maybe I should have opened a new thread... thought it was along the same vein...

    genesis_register_sidebar( array(
    'id'        => 'before-posts-sidebar',
    'name'      => 'Before Posts',
    'description'   => 'This is a sidebar that goes before the posts in the #content.',
    ) );

    add_action( 'genesis_before_loop', 'child_before_posts_sidebar' );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {

    echo '<div class="before-posts-sidebar">';
    dynamic_sidebar( 'before-posts-sidebar' );
    echo '</div>';

    }

    and I added what I think is the correct code for only the home page to:

    add_action( 'genesis_before_loop', 'child_before_posts_sidebar' );
    /** Loads a new sidebar before the posts in the #content */
    function child_before_posts_sidebar() {
    if ( is_home() ) {

    echo '<div class="before-posts-sidebar">';
    dynamic_sidebar( 'before-posts-sidebar' );
    echo '</div>';
    }

    }

    Thank you for your help.

    March 8, 2013 at 1:29 am #24951
    micki
    Participant

    oh and sorry, forgot to add, this is a different theme then Streamline.

    March 8, 2013 at 1:41 am #24953
    Brad Dalton
    Participant

    Micki

    You didn't copy and paste the raw code from this link https://gist.github.com/braddalton/5060622

    The code you have posted is Not the same.

    It doesn't matter which theme you are using unless its Prose. This code will work on most themes.

    What theme are you using?

    Where did you get that code you have posted?

    By the way, please read FAQ No.5 about posting code properly on these forums. Thanks.


    Tutorials for StudioPress Themes & WooCommerce.

    March 8, 2013 at 11:20 am #25014
    micki
    Participant

    I got the code from : http://designsbynickthegeek.com/tutorials/add-widgeted-sidebar

    See, you can tell how novice I am at this stuff... seeing slider and magazine in the code doesn't make sense to me :).

    I am using the MomPrenuer theme.

    Thanks!

    March 8, 2013 at 1:56 pm #25038
    micki
    Participant

    Ok, adding the if ( is_home() )... to the code i am working with worked great! Sorry if I highjacked this thread, i answered my own question, thanks for your input and help.

    March 11, 2013 at 12:58 pm #25489
    swansonwc
    Member

    Hi Brad,

    I've had a chance to implement your code, and the slider is working well -- except that it is on all pages. The conditional code to limit the slider to the home page didn't work, because I changed the home page to a static page using the 'sample page'. The post ID for the sample page is 2. Can I use the ID number in an if statement to limit the slider to the home page?

    Best regards,

    Bill

    March 11, 2013 at 7:46 pm #25553
    Brad Dalton
    Participant

    Hi Bill.

    Yes you can.

    genesis_register_sidebar( array(
      'id'  		=>   'home-custom',
      'name'		=> __( 'Home Custom', 'streamline' ),
      'description'	=> __( 'This is the custom widget area for your homepage.', 'streamline' ),
    ) );
    
    add_action( 'genesis_before_content_sidebar_wrap', 'child_before_content');
    function child_before_content() {
    if ( is_page(2) ) {
    		echo '<div id="home-custom">';
    		dynamic_sidebar( 'home-custom' );
    		echo '</div><!-- end #home-custom -->';
    	}
    
    }
    

    Tutorials for StudioPress Themes & WooCommerce.

    March 12, 2013 at 6:59 am #25633
    swansonwc
    Member

    Brad,

    Worked perfectly. Thank you.

    Best regards,

    Bill

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

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