WordPress.org

Support

Support » Themes and Templates » [Resolved] First page of blog different from /page/2/ etc

[Resolved] First page of blog different from /page/2/ etc

  • On my main blog page I have some extra text that appears above the posts.

    When a user clicks “Older posts” at the bottom of the first page and goes to http://myblog.com/page/2/ I don’t want that text to be there. I just want it to be on the first page of blog posts.

    I have added this copy to index.php above <?php if (have_posts()) : ?> but it appears on all the subsequent blog pages. Is is something with archive.php or archives.php?

Viewing 3 replies - 1 through 3 (of 3 total)
  • A Conditional Tags should help:

    <?php
    $paged = get_query_var(‘paged’);
    if (is_home() && ‘1’ = $paged) {
    //display extra text stuff here
    }
    ?>
    <?php if (have_posts()) : ?>

    Oops, revise that:

    <?php if (have_posts()) : ?>
    <?php
    $paged = get_query_var(‘paged’);
    if ( is_home() && $paged < 2) {
    echo ‘this is the home page and page 1’;
    }
    ?>

    Thanks.

    It ended up being easier to just use a static home page and import the first 5 posts.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] First page of blog different from /page/2/ etc’ is closed to new replies.
Skip to toolbar