WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] First page of blog different from /page/2/ etc (4 posts)

  1. chestertown
    Member
    Posted 5 years ago #

    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?

  2. MichaelH
    Member
    Posted 5 years ago #

    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()) : ?>

  3. MichaelH
    Member
    Posted 5 years ago #

    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';
    }
    ?>

  4. chestertown
    Member
    Posted 5 years ago #

    Thanks.

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

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.