i'm using a custom query, which needs to display all posts with closed comments.

I have this

<?php $the_query = new WP_Query('showposts=-1'); ?>
<?php while ($the_query -> have_posts()) : $the_query -> the_post(); ?>

<?php if (!comments_open()) : ?>
//some posts fomatting
<?php endif; ?>

<?php endwhile;?>

So, basically, this loops through all posts, and then displays only the ones with the closed comments.

It works, but i want to introduce the pagination to it. If i say posts_per_page instead of showposts, it doesn't work.

Any help would be appreciated :).


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.