WordPress.org

Ready to get started?Download WordPress

Forums

Pagination: How to display sidebar content on front page only? (2 posts)

  1. bobjones
    Member
    Posted 4 years ago #

    I need to place sidebar content on my blog that appears on the home page only.

    This means the content should display only at mysite.com and not at mysite.com/page/2/

    However, both the home page and inside pages use the same template, index.php, which means they both use the same sidebar.

    Is there a conditional script that would prevent my home page sidebar from appearing on inside pages?

    Thanks.

  2. alchymyth
    The Sweeper & Moderator
    Posted 4 years ago #

    there are lots of conditional tags, you could try to use:
    http://codex.wordpress.org/Conditional_Tags

    for instance:
    <?php if(is_home()) { get_sidebar(); } ?>

    or
    <?php if(!is_paged()) { get_sidebar(); } ?>
    this one might still show the sidebar on the first page of archives or categories, if there is no archive.php

Topic Closed

This topic has been closed to new replies.

About this Topic