WordPress.org

Ready to get started?Download WordPress

Forums

is_home does not function (4 posts)

  1. lcf
    Member
    Posted 8 years ago #

    WP version: 1.5.3-beta 1

    Problem:
    the is_home() function always return TRUE either at main page or previous page(e.g: domain.com/blog/page/2/ )

    Sample Code on index.php:
    <div id="content" class="narrowcolumn">
    <?php if (is_home()) { ?>
    this is home.
    <?php } ?>
    <?php if (have_posts()) : ?>

    Expected result:
    Show "this is home" on main page, but does not show on previous pages.

    Result getting:
    It shows "this is home" on main page AND other pages.

    Any idea? Thanks.

  2. iand
    Member
    Posted 8 years ago #

    Try <?php if (is_home() && ($paged <= "1")) { ?> instead.
    http://wordpress.org/support/topic/61041

  3. syncbox
    Member
    Posted 8 years ago #

    do you have a home.php file in your theme directory?

  4. lcf
    Member
    Posted 8 years ago #

    Thank you, IanD. That's the one!
    (apparently I missed the thread in my search)

    No, syncbox. I do not have a home.php file.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags