Add widget area above content on Streamline 2.0.1

Community Forums Forums Design Tips and Tricks Add widget area above content on Streamline 2.0.1

This topic is: not resolved

This topic contains 14 replies, has 3 voices, and was last updated by  swansonwc 1 year, 7 months ago.

Viewing 15 posts - 1 through 15 (of 15 total)
  • Author
    Posts
  • #24822

    swansonwc
    Participant
    Post count: 10

    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

    #24903

    braddalton
    Participant
    Post count: 10174

    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.com/forums/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.


    #24919

    swansonwc
    Participant
    Post count: 10

    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

    #24923

    micki
    Participant
    Post count: 26

    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.

    #24925

    braddalton
    Participant
    Post count: 10174

    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++


    #24927

    micki
    Participant
    Post count: 26

    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() )

    #24941

    braddalton
    Participant
    Post count: 10174

    Add all the code from that link Micki


    #24950

    micki
    Participant
    Post count: 26

    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.

    #24951

    micki
    Participant
    Post count: 26

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

    #24953

    braddalton
    Participant
    Post count: 10174

    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.


    #25014

    micki
    Participant
    Post count: 26

    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!

    #25038

    micki
    Participant
    Post count: 26

    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.

    #25489

    swansonwc
    Participant
    Post count: 10

    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

    #25553

    braddalton
    Participant
    Post count: 10174

    Hi Bill.

    Yes you can.
    [php]
    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 –>’;
    }

    }
    [/php]


    #25633

    swansonwc
    Participant
    Post count: 10

    Brad,

    Worked perfectly. Thank you.

    Best regards,

    Bill

Viewing 15 posts - 1 through 15 (of 15 total)

You must be logged in to reply to this topic.