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

  1. bobjones
    Posted 6 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?


  2. Michael
    Forum Moderator
    Posted 6 years ago #

    there are lots of conditional tags, you could try to use:

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

    <?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