Get ALL post types in WordPress in query_posts -
i'm using query_posts list of popular posts. i'm using several custom post types, , instead of including of them in query, query gets of them, if create more.
this have:
query_posts(array( 'meta_key' => 'post_views_count', 'orderby' => 'meta_value_num', 'order' => 'desc', 'post_type' => array('posttype1', 'postype2', 'posttype3') ) ); if don't include post_type, gets standard post type, post. have idea?
you can use 'post_type' => 'any' fetching post types. see documentation. http://codex.wordpress.org/class_reference/wp_query#type_parameters
note: highly recommended use wp_query rather query_posts. https://wordpress.stackexchange.com/a/1755/27998
Comments
Post a Comment