Sorry for the awful title, I couldn’t think of anything better.
Basically I have this code:
<div id="slideshow-side-tab">
<img src="<?php bloginfo('template_directory'); ?>/images/bg-slideshow.png"/>
<div id="slideshow">
<img src="<?php bloginfo('template_directory'); ?>/images/slideshow/image-1.jpg" alt="" class="active" />
<img src="<?php bloginfo('template_directory'); ?>/images/slideshow/image-2.jpg" alt="" />
<img src="<?php bloginfo('template_directory'); ?>/images/slideshow/image-3.jpg" alt="" />
<img src="<?php bloginfo('template_directory'); ?>/images/slideshow/image-4.jpg" alt="" />
</div>
</div>
However I only want this to display when the user is on the front page of WordPress. The homepage has been set to a static page created from within wordpress and I can’t just copy this code into the page as it only accepts HTML in the page editor. How can I make this happen?
I have had a look on WordPress and I found this:
<?php
if (is_home()) {
// This is a homepage
} else {
// This is not a homepage
}
?>
But that doesn’t seem to work if I place my code in place of the ‘// This is a homepage’.
Any help would be appreciated. Thanks.
Try with:
You need to copy / paste your page.php. Than create a separate template file where you can insert your code for the slideshow or a custom field for it.
http://codex.wordpress.org/Pages#Page_Templates
or
http://codex.wordpress.org/Custom_Fields