Ver Mensaje Individual
  #1 (permalink)  
Antiguo 07/02/2012, 11:53
belenguer
 
Fecha de Ingreso: enero-2012
Mensajes: 7
Antigüedad: 12 años, 3 meses
Puntos: 0
Query - Posts con 0 comentarios

Hola, estoy haciendo un query en wordpress, que me devuelve un listado de post segun los comentarios, tengo uno que devuelve los post ordenados de mas a menos comentarios y ahora querria uno que me devolviera los post que no tienen comentarios, pero no encuentro como hacerlo.

Este es el código:

Código PHP:
$query '';
global 
$options_rating;
foreach ( 
$options_rating['widget-pages'] as $key => $value ) {
    if ( 
get_the_ID() == $value ) {
        switch(
$key) {
            case 
'mostComment':
            
$query "select ".$wpdb->prefix."posts.ID
            from "
.$wpdb->prefix."comments,".$wpdb->prefix."posts
            where 
            "
.$wpdb->prefix."posts.ID = ".$wpdb->prefix."comments.comment_post_ID and
            post_status = 'publish'    and 
            post_type = 'post'
            group by comment_post_ID order by count(comment_post_ID) DESC
            limit "
.$options_rating['widget-pages-limit'];        
            break;
            case 
'noComment':
            
$query "select ".$wpdb->prefix."posts.ID
            from "
.$wpdb->prefix."comments,".$wpdb->prefix."posts
            where 
            "
.$wpdb->prefix."posts.ID = ".$wpdb->prefix."comments.comment_post_ID and
            post_status = 'publish'    and 
            post_type = 'post'
            group by comment_post_ID order by count(comment_post_ID)='0' DESC
            limit "
.$options_rating['widget-pages-limit'];        
            break;
        }
    }



Y esta es la parte que no me funciona

Código PHP:
            case 'noComment':
            
$query "select ".$wpdb->prefix."posts.ID
            from "
.$wpdb->prefix."comments,".$wpdb->prefix."posts
            where 
            "
.$wpdb->prefix."posts.ID = ".$wpdb->prefix."comments.comment_post_ID and
            post_status = 'publish'    and 
            post_type = 'post'
            group by comment_post_ID order by count(comment_post_ID)='0' DESC
            limit "
.$options_rating['widget-pages-limit'];        
            break; 

¿Alguien me puede echar un cable? Muchas Gracias!