themes - Wordpress index.php: Show div just when site contains 6 posts -
in wordpress index.php need know if page has enough posts (more 6) pagination active or not , when pagination active want show div element.
you can count number of posts in query using $post_count. example:
<?php // query $the_query = new wp_query( $args ); $post_count = $the_query->post_count; if ( $post_count > 6 ) { // show div here... } ?>
read more in codex.
Comments
Post a Comment