Archived topic
Slider
5 replies · Started by Prateek on May 5, 2015
Hi Tom,
On my web http://ispotted.net/forestry/ I have a slider inserted using WonderPlugin Carousel. I used the php code: <?php echo do_shortcode('[wonderplugin_carousel id="1"]'); ?> and embedded at the very end of header.php file.
However, it shows up on every page I go to. I just want to have that slider on the home page. How can I fix it?
Please let me know.
Thanks in advance, Prateek
Hey try something like this:
<?php if ( is_home() ) { echo do_shortcode('[wonderplugin_carousel id="1"]'); } ?>
Maybe this could help you!
if does not work, try this:
<?php if ( is_page(PAGE_ID) ) { echo do_shortcode('[wonderplugin_carousel id="1"]'); } ?>
If you don't know your #PAGE_ID, go to Edit Page > on the URL localhost/wordpress/wp-admin/post.php?post=2&action=edit > 2 is the page ID.
Thanks for the above, Jean!
Another alternative is:
<?php if ( is_front_page() ) : ?>
<?php echo do_shortcode('[wonderplugin_carousel id="1"]'); ?>
<?php endif; ?>
Thanks Jean and Tom for the help. It works now.
Tom's code worked. Jean, I was getting an error - I believe it was the page_id as you mentioned but appreciate the help.
Prateek
Glad you got it working :)