Code change if is paged
-
Hi! I’m trying to get some piece of code to work but don’t have any result. The following code insert a div between two posts on the index page, but I need to change that on pagination.
<?php if (($wp_query->current_post%2 == 0 )) { echo '<div style="background-color: #ffcc00; width: 100%; display: block; height: 25px; clear: both; float: left;"></div>'; } ?>If is front page the value of wp_query is correct, but if is page 2 it must be “($wp_query->current_post+1)%2 == 0”. How can I do that and not break the function?
Thanks in advance! =)
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Code change if is paged’ is closed to new replies.