I have simple page that I want to display a list of posts that haven't been commented on yet. How would I do this? I presume it's some parameters I can add to the query_posts? Thanks.
相关问题
- Views base64 encoded blob in HTML with PHP
- Laravel Option Select - Default Issue
- PHP Recursively File Folder Scan Sorted by Modific
- Can php detect if javascript is on or not?
- Using similar_text and strpos together
Unfortunately query_posts does not allow you to limit the query to
comment_count=0
. You can do this:But that does not only display posts with zero comments, it just displays those with zero comments first.
The more involved (but better) solution is to use a custom query that specifically limits the query to posts with 0 comments, but that means you would have to create your own loop structure (at least so far as I can tell)
Does that seem within your knowledge to implement?
as simple as :
You can set up a filter and query varaible to modify the SQL that queries the posts. Add this to your theme's
functions.php
fileThen you can call
query_posts( 'comment_count=0' );
(any number), you'll just want to add the filter beforehand,And after you make the call, you may want to remove the filter as well.