WordPress.org

Ready to get started?Download WordPress

Forums

Meta Slider
[resolved] Only on home page code not working. (5 posts)

  1. webchap
    Member
    Posted 1 year ago #

    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/

  2. webchap
    Member
    Posted 1 year ago #

    Just to add I did use the code you put on there for the intention of 'only show on home page'

  3. Matcha Labs
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  4. webchap
    Member
    Posted 1 year ago #

    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.

  5. Matcha Labs
    Member
    Plugin Author

    Posted 1 year ago #

    Cool, I can never remember which one does which :)

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

    Regards,
    Tom.

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic