Slider on non-static home page

Community Forums Forums Design Tips and Tricks Slider on non-static home page

This topic is: not resolved

This topic contains 3 replies, has 2 voices, and was last updated by  keri 1 year, 11 months ago.

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #4133

    keri
    Participant

    I’m using the Outreach child theme and am trying to insert a slider on my home page between the menu and the loop (at the genesis_before_content hook), but am having some problems… sort of.

    I added the following to functions.php:

    add_action( 'genesis_before_content', 'kw_before_content', 1);
    function kw_before_content() {
    if ( is_home())
    echo do_shortcode('[layerslider id="5"]');}

    This works great, displaying it only on the homepage (don’t want it on static pages) except there’s no space between the slider and the content. So, I figured that it would be simple enough to just wrap the slider in some divs and add some padding like this:

    add_action( ‘genesis_before_content’, ‘kw_before_content’, 1);
    function kw_before_content() {
    if ( is_home())
    echo ‘<div style=padding-bottom: 10px>’;
    echo do_shortcode(‘[layerslider id="5"]‘);
    echo ‘</div>’;}

    This displays fine on the home page, with the padding just right… but it displays on every other page as well, without the padding. I tried sticking wp_reset_query into the footer to try resetting the is_home function, but that just broke the site (I’m not exactly sure that I did it properly though… just added the line add_action('genesis_footer','wp_reset_query'); right above the conditional statement, but within the function kw_before_content.). Also tried putting this into the conditional statement:

    && !is_page() 

    But still no luck. Putting the divs is is screwing things up, and I’ve got a feeling it’s something extremely simple that I’m overlooking.

    Does anyone know how I can fix this problem? Or if there’s another easy way to get a slider to do what I want?

    Here’s the site (just started working on it, don’t judge): http://www.keriwilk.com

    Thanks so much for any help you can provide!

     

    Keri

    #4134

    keri
    Participant

    Well that’s embarrassing…. obviously I’ve never submitted a post here, so I’m sorry about the weird formatting of that post!

    Keri

    #4236

    nickthegeek
    Keymaster
    Post count: 751

    Keri,

    While we work on getting a better system for the on site code. Could you put your code into pastie.org and share teh link.

    http://pastie.org

    #4254

    keri
    Participant

    http://pastie.org/5508045#

    By the way, I’ve found your Genesis tutorials incredibly helpful, Nick. You’re doing a great job.

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

You must be logged in to reply to this topic.