Friday, July 10, 2009

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

1 comment :

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

    ReplyDelete