Support » Plugin: Meta Slider » Only on home page code not working.

  • Resolved webchap

    (@webchap)


    Hi, having trouble only displaying slider on home page.

    Created home page using standard twentyeleven theme (i called it homepage). Created home page (Sidebar Template) added the text I want on there etc.

    Created slider (Nivo)
    I then added in your code to the header.php and all fine. Shows as I want it on home page.

    I then created a blank ‘News’ page and also selected the ‘Sidebar template’.

    Went to ‘Reading’ and selected that the home page be static and point to the ‘homepage’ page and for posts go to ‘news’ page.

    Now the slider appears on both the home and news pages using Sidebar template. Created another page and all fine, no slider showing when it shouldn’t be. Must just be for the page where posts appear? Any help most welcome.

    http://wordpress.org/extend/plugins/ml-slider/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Just to add I did use the code you put on there for the intention of ‘only show on home page’

    Plugin Contributor matchalabs

    (@matchalabs)

    Hi,

    Try changing it to:

    <?php
    if (is_home()) {
        echo do_shortcode("[metaslider id=123]"); //replace 123 with slider ID
    }
    ?>

    or

    <?php
    if (is_front_page()) {
        echo do_shortcode("[metaslider id=123]"); //replace 123 with slider ID
    }
    ?>

    Regards,
    Tom.

    That’s great thanks. First one took it off home page and only left it on the news page. Second code did the opposite which is what I wanted. Many thanks for your help.

    Plugin Contributor matchalabs

    (@matchalabs)

    Cool, I can never remember which one does which 🙂

    If you get a spare minute please consider leaving a review!

    Regards,
    Tom.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Only on home page code not working.’ is closed to new replies.