• Resolved Kendra

    (@magic88)


    Please refer to: https://childinjuryprevention.ca/

    The image near the top of the page is a slideshow. I want the only place for viewers to see the slideshow of images to be on the front page (not when you click on a post, archives, a category, a tag, etc).

    I tried to do this by replacing “<?php get_header(); ?>” in index.php with “<?php include(TEMPLATEPATH.’/header-frontpage.php’); ?>”. However, now when I click on “← Older posts” there are a bunch of broken images where the slideshow was on the front page. (I do not want the slideshow on the “Older posts” page.)

    Are there any suggestions on how I would make it so the slideshow only shows on the front page?

    Thank you in advance!

    Edit: Could I use conditionals?
    Edit: Oops, never mind. Conditionals don’t seem to work.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Could I use conditionals?

    Yes – in header.php

    <?php if( !is_home() && !is_front_page() ) :?>
    [ slideshow ]
    <?php endif;?>

    Have you thought about creating a new page template? It would work nicely if your front page is a static one.

    Thread Starter Kendra

    (@magic88)

    esmi — Thanks! Your post was helpful. However, it’s still not working for some reason. Shouldn’t it be if is_home() && is_front_page() instead of !is_home() && !is_front_page()? I only want my slideshow to show on my home page (where the blog is), which is also my front page.

    I changed my index.php back to normal (to get_header() instead of include(TEMPLATEPATH.’/header-frontpage.php’);)

    I tested the following code in my header.php. The slideshow did not show on any posts/pages when this code was written:

    <?php if ( is_home() && is_front_page() ) { ?>
      [slideshow]
    <?php } ?>

    edwardlw — I definitely need the front page to be non-static. Thank you for your suggestion, though.

    Edit: Thank you for your suggestions, everyone. I think I am just going to delete the “Older Posts” link, and that will hopefully solve my problems.

    Sorry – yes. I got it the wrong way around. Use:

    <?php if( is_home() && is_front_page() ) :?>
    [ slideshow ]
    <?php endif;?>
    Thread Starter Kendra

    (@magic88)

    I decided that I do need those “”Older posts” and “Newer Posts” links.

    esmi – Thanks you. The website (https://www.childinjuryprevention.ca) is still doing the exact same thing (as described in my first post), though. (If I go to Settings > Reading, my “Front page displays” “Your latest posts”.)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Make front page (with blog) different from all other pages/posts’ is closed to new replies.