WordPress: Display only on first page

This code will enable you to display items such as text or image only on the first page of the homepage or archive.

It can be use in index.php, category.php or archive.php.

What you need is the $page WordPress variable. 1 for the first page of results, 2 for the second page, etc.

To use it, put the code inside The Loop.

<?php if ( $paged < 2 ) { ?>

Your text or image for the first page goes here!

<?php } else { ?>
If you are new here, you might want to subscribe to the RSS feed or newsletter.

Enter your email address:

Related

This entry was posted in WordPress and tagged , , , . Bookmark the permalink.

One Response to WordPress: Display only on first page

  1. I was looking all over for how to do this. Thanks for posting!
    -Paul

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>