Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Unfortunately query_posts does not allow you to limit the query to <code>comment_count=0</code>. You can do this:</p> <pre><code>query_posts( 'orderby=comment_count&amp;order=ASC' ); </code></pre> <p>But that does not <em>only</em> display posts with zero comments, it just displays those with zero comments <em>first</em>.</p> <p>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 <a href="http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query" rel="nofollow">so far as I can tell</a>)</p> <pre><code>global $wpdb; $query = " SELECT * FROM {$wpdb-&gt;prefix}posts WHERE {$wpdb-&gt;prefix}posts.post_type = 'post' AND {$wpdb-&gt;prefix}posts.post_status = 'publish' AND {$wpdb-&gt;prefix}posts.comment_count = 0 ORDER BY {$wpdb-&gt;prefix}posts.post_date DESC; "; $pageposts = $wpdb-&gt;get_results($query, OBJECT); &lt;?php if ($pageposts): ?&gt; &lt;?php global $post; ?&gt; &lt;?php foreach ($pageposts as $post): ?&gt; &lt;?php setup_postdata($post); ?&gt; &lt;div class="post" id="post-&lt;?php the_ID(); ?&gt;"&gt; &lt;h2&gt;&lt;a href="&lt;?php the_permalink() ?&gt;" rel="bookmark" title="Permanent Link to &lt;?php the_title(); ?&gt;"&gt; &lt;?php the_title(); ?&gt;&lt;/a&gt;&lt;/h2&gt; &lt;small&gt;&lt;?php the_time('F jS, Y') ?&gt; &lt;!-- by &lt;?php the_author() ?&gt; --&gt;&lt;/small&gt; &lt;div class="entry"&gt; &lt;?php the_content('Read the rest of this entry »'); ?&gt; &lt;/div&gt; &lt;p class="postmetadata"&gt;Posted in &lt;?php the_category(', ') ?&gt; | &lt;?php edit_post_link('Edit', '', ' | '); ?&gt; &lt;?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?&gt;&lt;/p&gt; &lt;/div&gt; &lt;?php endforeach; ?&gt; &lt;?php else : ?&gt; &lt;h2 class="center"&gt;Not Found&lt;/h2&gt; &lt;p class="center"&gt;Sorry, but you are looking for something that isn't here.&lt;/p&gt; &lt;?php include (TEMPLATEPATH . "/searchform.php"); ?&gt; &lt;?php endif; ?&gt; </code></pre> <p>Does that seem within your knowledge to implement?</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload