Viewing 6 replies - 1 through 6 (of 6 total)
  • Ramona

    (@nextend_ramona)

    Hi,

    You will need to put the slider’s code to your theme’s php file using a code like this:

    <?php
        if(is_home()|| is_front_page()){
            echo do_shortcode('[smartslider2 slider="1"]');
        }
    ?>

    which will display the slider on the home page only.

    However, it is possible that for some reason, the blog page is recognized as home page. You can check it like this:
    <?php
    var_dump(is_home());
    ?>
    and if the site writes out a “true” value, you could use the home page page id to make the slider only appear there:

    <?php
    if(get_the_ID()==39){
      echo do_shortcode('[smartslider2 slider="1"]');
    }
    ?>

    you can find the page id to your homepage if you look at the url:
    wp-admin/post.php?post=39&action=edit
    where the 39 is your page id.

    If you would need further help on this, please contact us on [email protected] and please refer to this topic!

    Thread Starter Harry.singh

    (@harrysingh-1)

    Hi,
    Thanks for your response. Could you please explain which php file should I look as I am not a professional.
    Kindly help and let me know the steps and which PHP file should I look and edit.

    Regards,
    Harry

    Ramona

    (@nextend_ramona)

    Hi Harry,

    The where you should put the slider’s code is your theme’s header.php.

    If using the is_home() code would still put the slider to your blog page:
    The file where you should debug if the blog page is recognized as homepage or not by WordPress is the page.php file of your theme.

    If you would like me to help you debug this, feel free to open a support ticket at [email protected]!

    Thread Starter Harry.singh

    (@harrysingh-1)

    Hi Team,
    This code
    <?php
    if(is_home()|| is_front_page()){
    echo do_shortcode(‘[smartslider2 slider=”1″]’);
    }
    ?>

    this code already added in header.php file and slider removed from the all the pages except the blog page. I want to remove from blog page.
    I did not find any code in page.php file
    <?php
    var_dump(is_home());
    ?>

    Kindly help to resolve this

    Ramona

    (@nextend_ramona)

    Hi Harry,

    Your problem will be that your WordPress is recognizing your blog page as “home” page too, so you should use the home page’s id instead:

    <?php
    if(get_the_ID()==39){
      echo do_shortcode('[smartslider2 slider="1"]');
    }
    ?>

    Just determine your home page id by looking at the URL when you are editing your home page.

    Also, you can’t find this code in your page.php:

    <?php
    var_dump(is_home());
    ?>

    because this is not a code required to create themes, but it is used to debug problems – in our case to determine if the blog page is recognized as home page or not.

    Thread Starter Harry.singh

    (@harrysingh-1)

    Hi,
    Thanks a lot for your kind support. Its resolved and understood your point.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Removing slider from blog also.’ is closed to new replies.