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.

  • http://alabuzz.org alaJoAnn

    I just created a static “Home” page for alabuzz.org. (It uses the PrimePress theme, which has a special homepage template for static home pages.) The SmoothSlider was already on what is now the “Blog” page. When I try to remove it from the Blog page (which is still the index.php) and put the code in the Home page, two things happen:

    1) SmoothSlider does not appear on the new “Home” page.
    2) The Blog page disappears.

    I’ve tried disabling SmoothSlider. And I’ve tried removing the code from the blog page only. On the other side, I’ve tried inserting the code in every possible place in the homepage.php, and nothing!

    There must be more than what meets my code-challenged eye. Do I need to reinstall? And if so, where do I place the code in the homepage.php. It’s short so I’ll paste it below.

    Thank you for your help!

    <div class="entry" id="post-”>

    <?php wp_link_pages('before=‘ . __(‘Pages:’) . ‘&after=’); ?>

  • http://www.clickonf5.org Tejaswini

    @alaJoAnn I have opened the thread for the Smooth Slider implementation on your blog at http://www.clickonf5.org/phpbb/smooth-slider-f12/want-smooth-slider-homepage-php-and-not-index-php-t42.html
    Please post all the communication on the Smooth Slider support in the forum, so I would be able to put the solution at the earliest. Thanks for your patience.

  • http://oppositeimage.net/v01 fawz

    hi,

    don’t know where to start. this smooth slider suppose appear on my mainpage ( http://oppositeimage.net/v01 ) which is a static page. but currently, it appear on my bloging section. i’m not good in handling coding but perhaps you can show me how to do it.

  • http://www.phirebase.com/ brtak

    Thank you very much, its working fine for me now.

  • http://caresfgh.org joey

    hello,

    great plug in.
    i wanted to know if the slider can be placed on a different page instead of the “home” page. for example, can i place the slider on my “about” page?

    here’s the url to my testing site.
    http://www.caresfgh.org/testingsite/

    thanks!

    joey

  • http://mulangtinande.net Achmad Allam

    Can you describe more for inserting that code. Still hard to understand! Please!

  • Lee Timotheou

    If like me you want to use this plugin on the home page of your blog and that page happens to be a static page then this is what I did to get it working:

    1) create a seperate page template, I copyed and renamed page.php to page2.php then added this code to top line:

    Dont forget to upload this page!

    2) Copy in the silder code (if you haven’t already) where you want it to appear in your new template –

    3) Go to your homepage in wordpress editor and under attributes there will be an option for ‘Page with Silder’ Just select this and only that page will show the silder.

  • http://www.drukpa.bt admin

    my smooth slider is not working.
    pls. suggest what to do to make it functionable.

  • http://www.clickonf5.org Tejaswini

    Please open a ticket at clickonf5.com support system.
    Thank you.
    -Tejaswini

  • http://www.santosoblog.com Santoso

    i has installed this plugin on my blog… so how i put the code on index.php? i want display with 3 categories….
    can you sow on this page detailsof code?….

  • http://www.clickonf5.org Tejaswini

    Can you please create a support query/ticket on clickonf5.com? We do not provide support thru comments section as the support requests in comments cannot be tracked properly.

  • http://dscottangle.com D Scott Angle

    This is a great plug-in and a very good response to this question, but I have to ask, how can I make it work the other way?

    Basically, I want the slider to appear on all pages (posts actually) EXCEPT the homepage.

    I look forward to hearing your advice.

    Thanks,

    Scott

  • diamantesbrutos

    I really want to know this too!
    if (!is_admin() or !is_home())
    doesn’t work :(