Community Forums › Forums › Design Tips and Tricks › Slider on non-static home page
This topic contains 3 replies, has 2 voices, and was last updated by keri 5 months, 1 week ago.
-
AuthorPosts
-
December 10, 2012 at 4:16 am #4133
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_contenthook), 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
divsand 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_queryinto the footer to try resetting theis_homefunction, but that just broke the site (I’m not exactly sure that I did it properly though… just added the lineadd_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
December 10, 2012 at 4:17 am #4134Well that’s embarrassing…. obviously I’ve never submitted a post here, so I’m sorry about the weird formatting of that post!
Keri
December 10, 2012 at 12:59 pm #4236Keri,
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.
December 10, 2012 at 2:23 pm #4254By the way, I’ve found your Genesis tutorials incredibly helpful, Nick. You’re doing a great job.
-
AuthorPosts
You must be logged in to reply to this topic.