Spyder.RV 0 Denunciar post Postado Agosto 26, 2013 Galera, eu estou com um problema na WP_Query abaixo... $args = array( 'post_type' => 'portfolio', // Custom Post Type: 'portfolio' 'post_status' => 'Published', 'pagination' => false ); $query = new WP_Query( $args ); while ( $query->have_posts() ) { $query->the_post(); echo "<p>ID: " . get_the_id() . " - Title: " . get_the_title() . "</p>"; } Essa query só tá listando um único post, sendo que tenho vários itens de Portfólio cadastrados e publicados e preciso listar todos esses posts...O que tá faltando na query ? Compartilhar este post Link para o post Compartilhar em outros sites
Heitor Sousa 9 Denunciar post Postado Agosto 26, 2013 Cara costumo utilizar assim , verifica se dá certo: <?php $args = array( 'category_name' => 'destaque'); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> <?php the_title(); ?> <?php the_content(); ?> <?php endwhile; ?> Compartilhar este post Link para o post Compartilhar em outros sites
Spyder.RV 0 Denunciar post Postado Agosto 26, 2013 Nada cara... retirei o loop todo... e dei um print_r( $query ) e só tá listando um post mesmo... WP_Query Object ( [query_vars] => Array ( [post_type] => portfolio [post_status] => ublished [pagination] => [error] => [m] => 0 [p] => 0 [post_parent] => [subpost] => [subpost_id] => [attachment] => [attachment_id] => 0 [name] => [static] => [pagename] => [page_id] => 0 [second] => [minute] => [hour] => [day] => 0 [monthnum] => 0 [year] => 0 [w] => 0 [category_name] => [tag] => [cat] => [tag_id] => [author_name] => [feed] => [tb] => [paged] => 0 [comments_popup] => [meta_key] => [meta_value] => [preview] => [s] => [sentence] => [fields] => [menu_order] => [category__in] => Array ( ) [category__not_in] => Array ( ) [category__and] => Array ( ) [post__in] => Array ( ) [post__not_in] => Array ( ) [tag__in] => Array ( ) [tag__not_in] => Array ( ) [tag__and] => Array ( ) [tag_slug__in] => Array ( ) [tag_slug__and] => Array ( ) [ignore_sticky_posts] => [suppress_filters] => [cache_results] => 1 [update_post_term_cache] => 1 [update_post_meta_cache] => 1 [posts_per_page] => 1 [nopaging] => [comments_per_page] => 50 [no_found_rows] => [order] => DESC ) [tax_query] => WP_Tax_Query Object ( [queries] => Array ( ) [relation] => AND ) [meta_query] => WP_Meta_Query Object ( [queries] => Array ( ) [relation] => ) [post_count] => 1 [current_post] => -1 [in_the_loop] => [comment_count] => 0 [current_comment] => -1 [found_posts] => 2 [max_num_pages] => 2 [max_num_comment_pages] => 0 [is_single] => [is_preview] => [is_page] => [is_archive] => [is_date] => [is_year] => [is_month] => [is_day] => [is_time] => [is_author] => [is_category] => [is_tag] => [is_tax] => [is_search] => [is_feed] => [is_comment_feed] => [is_trackback] => [is_home] => [is_404] => [is_comments_popup] => [is_paged] => [is_admin] => 1 [is_attachment] => [is_singular] => [is_robots] => [is_posts_page] => [is_post_type_archive] => [query_vars_hash] => 61be65e543cd1c9b0d7b5c68a4c3f031 [query_vars_changed] => [thumbnails_cached] => [query] => Array ( [post_type] => portfolio [post_status] => Published [pagination] => ) [request] => SELECT SQL_CALC_FOUND_ROWS wp_posts.ID FROM wp_posts WHERE 1=1 AND wp_posts.post_type = 'portfolio' ORDER BY wp_posts.post_date DESC LIMIT 0, 1 [posts] => Array ( [0] => WP_Post Object ( [ID] => 101 [post_author] => 1 [post_date] => 2013-08-26 12:04:42 [post_date_gmt] => 2013-08-26 15:04:42 [post_content] => Portfolio 02 content [post_title] => Portfolio 02 [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => portfolio-02 [to_ping] => [pinged] => [post_modified] => 2013-08-26 12:04:42 [post_modified_gmt] => 2013-08-26 15:04:42 [post_content_filtered] => [post_parent] => 0 [guid] => http://www.tecprintrv.com.br/?post_type=portfolio&p=101 [menu_order] => 0 [post_type] => portfolio [post_mime_type] => [comment_count] => 0 [filter] => raw ) ) [post] => WP_Post Object ( [ID] => 101 [post_author] => 1 [post_date] => 2013-08-26 12:04:42 [post_date_gmt] => 2013-08-26 15:04:42 [post_content] => Portfolio 02 content [post_title] => Portfolio 02 [post_excerpt] => [post_status] => publish [comment_status] => closed [ping_status] => closed [post_password] => [post_name] => portfolio-02 [to_ping] => [pinged] => [post_modified] => 2013-08-26 12:04:42 [post_modified_gmt] => 2013-08-26 15:04:42 [post_content_filtered] => [post_parent] => 0 [guid] => http://www.tecprintrv.com.br/?post_type=portfolio&p=101 [menu_order] => 0 [post_type] => portfolio [post_mime_type] => [comment_count] => 0 [filter] => raw ) ) Compartilhar este post Link para o post Compartilhar em outros sites
Spyder.RV 0 Denunciar post Postado Agosto 26, 2013 Credo!!!Só lista o mais recente... e ponto final! Até troquei a minha query filtrar 'post_type'=>'post' e continua na mesma... só vem o mais recente cadastrado... o resto o wordpress engole!!!! Compartilhar este post Link para o post Compartilhar em outros sites
Spyder.RV 0 Denunciar post Postado Agosto 27, 2013 Consegui... Link da resolução: http://br.forums.wordpress.org/topic/wp_query-listando-apenas-um-post-porem-preciso-listar-todos?replies=3 Compartilhar este post Link para o post Compartilhar em outros sites