WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Unique Front Page (Dynamic Content) (4 posts)

  1. coplan
    Member
    Posted 5 years ago #

    My blog's theme has a block on its front page which provides highlights for all the latest and most popular posts. I want it to disappear, however, when a person is browsing posts through the next/previous links. I've tried using the is_home() function and the is_front_page() function, but it seems to believe all of the browsing through the next/previous links is the home or the front page.

    How would I alter the theme so that the box only shows up on the front page?

    If this makes no sense, a visit to my site may help. My site is shutter.antisoc.net. The box in question is the one in the center with the latest posts, latest photos and popular posts. IF you go to the bottom and click "older posts", you of course get the older posts, but the box is still there - and I don't want it to be.

    Much appreciated for any help you can proide

  2. t31os
    Member
    Posted 5 years ago #

    Can you post the code from the page that generates the box... likely index.php of your theme.

  3. MichaelH
    Member
    Posted 5 years ago #

    The Conditional Tag is_paged() should work for you:

    <?php
    if (is_paged()) {
    //this is main page or 1st page of archives
    } else {
    //this is 2nd page of posts either main or archive
    }
    ?>
  4. coplan
    Member
    Posted 5 years ago #

    Awesome...the is_paged worked well for me. This is essentially what I did:

    <?php if(!is_paged() && !is_single() && !is_page()): ?>
      <!-- the block code goes here -->
    <?php endif; ?>

    The !is_paged() appears to be placing it only on the home page. I had to add the !is_single() to keep it from popping up on single posts and I added the !is_page() to keep it from popping up on page elements.

Topic Closed

This topic has been closed to new replies.

About this Topic