First Template – adding slider to home page only
-
Hi,
I have reviewed similar topics in the forum but previous code suggestions aren’t working on my template. I want to include a metaslider on my home page only. If I use this code, <?php if ( is_page( ‘home’ )) echo do_shortcode(‘[metaslider id=”512″]’); ?>
I can see the slider, but only if I delete all the elseif statements below. Unfortunately when I delete the other statements the slider appears on all pages. I know there is some magic piece of code I am missing but I have tried every possible combination and would be incredibly grateful if someone could point me in the right direction. Thank you in advance.This is the code on the header.php file that I am trying to edit:
<?php if ( is_home() && get_header_image() ) : ?>
<div id=”header-image” class=”header-image”>
<img src=”<?php header_image(); ?>” width=”<?php echo get_custom_header()->width; ?>” height=”<?php echo get_custom_header()->height; ?>” alt=””>
</div><!– #header-image –>
<?php elseif ( is_page() && has_post_thumbnail() ) : ?>
<div id=”header-image” class=”header-image”>
<?php the_post_thumbnail( ‘first-page-thumbnail’ ); ?>
</div><!– #header-image –>
<?php endif; ?>
</header><!– #masthead –>
- The topic ‘First Template – adding slider to home page only’ is closed to new replies.