I want to add text but only appear on the homepage only. I have used this if script:
<?php if( is_home() ) : ?> <p>Some text</p> <?php endif;?>
but the problem with this is it’s appearing on every paginated page. So for example if I view
http://www.example.com/page/2/ it will show that text. I only want it appear on 1st page.
Any fix to this?
You can use
…checks if page being displayed is “paged” and the current page number is greater than one. This is a boolean function, meaning it returns either TRUE or FALSE.
You can adjust your code as follows
<?php if( is_home() && !is_paged() ) : ?> <p>Some text</p> <?php endif;?>
There is another way you can show text block in all pages and categories but hide it on the homepage and vice versa.
<?php if( is_front_page() =="" ) : ?> <p>Some text here</p> <?php endif;?>