Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

i'm interested how to display all posts (from all categories) that have closed/disabled comments?

I have tried using the comments_open() function inside the loop, that works, i don't know how to enable pagination on it, and here's why:

wp query - here's the query that displays all posts, i set here how many per page should be displayed if (!comments are open) i list the posts

so, the problem here is that i want to show 10 posts per page -the loop actually goes through 10 posts, and displays any post of the given 10 that has closed comments, and then creates a second page with 10 posts and does the same etc...

I need a filter inside the loop itself, so i display 10 posts with disabled comments PER PAGE.

Pls, can anyone help with this?

share|improve this question

1 Answer 1

I don't have the time right now to work the code, but you'll need to use pre_get_posts and filter out based upon comment_status => 'open'.

share|improve this answer
    
I really appreciate your answer. Can you please post more details about this. I didn't find much tutorials and examples on this filter, but it seems it can do what i need :). –  Nicholas Sep 11 '12 at 21:32

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.