How To Display Smooth Slider On The Home Page Only

Most of the themes use the index.php file for the homepage of the blog. If you put the Smooth slider template tag to the index.php code, you would get the slider on each of the pages using the index.php file like the category pages, tag pages, about and contact pages and so on, depending on your theme. This is because as index.php lies to the root of the WordPress template hierarchy.

So while adding the template tag to index.php, be sure about the pages on which you want the Smooth Slider slideshow. If you want it on only the home page follow the below guidelines:-

Template tag to add Smooth Slider to the blog page:

if ( function_exists( 'get_smooth_slider' ) ) {
     get_smooth_slider(); }

Adding one more condition for the template tag would result in the Smooth Slider to appear on only Home page and the subsequent Paged pages showing the older entries on the blog:-

if ( function_exists( 'get_smooth_slider' ) and is_home() ) {
 get_smooth_slider(); }

And if you do not wish to let the smooth slider on the paged pages showing the older entries on subsequent pages, modify the call as follows:-

if ( function_exists( 'get_smooth_slider' ) and is_home()
and !is_paged() ) {
 get_smooth_slider(); }

Thus, you can insert the above template tag to your index.php so that you can show the slider on only the home page of your wordpress blog.

Leave a Reply

Your email address will not be published. Required fields are marked *