Reputation: 3225
I have an image slider plugin and i use this in my PHP header (header.php) to display it only on the homepage
<?php putRevSlider("home", "homepage") ?>
I want to display spaces/line breaks above and below the slider but only if on the homepage. i tried doing:
<?php
if( is_home() ) : ?>
<p> </p><p> </p>
<?php putRevSlider("home", "homepage") ?>
<p> </p>
<?php endif; ?>
but that does not display anything
Upvotes: 0
Views: 225
Reputation: 871
If you have a custom home page, you can experience difficulties with is_home()
Try getting the post_id
and matching it against the wp_option get_option('page_on_front')
<?php
global $post;
if( get_option( 'page_on_front' ) == $post->ID : ?>
<p> </p><p> </p>
<?php putRevSlider("home", "homepage") ?>
<p> </p>
<?php endif; ?>
Upvotes: 0
Reputation: 591
Use is_front_page()
instead of is_home()
- this ensures you are on the actual 'front page' instead of the 'home page' (which defaults to the blog posts page, index.php).
Upvotes: 3
Reputation: 2142
Check if your Theme apply a class to the wrapper container and solve this via css ( usually a standard )
with the class .home tag
and add padding to
.home .slider_container { padding:20px 0 0 20px }
Upvotes: 1