Support » Developing with WordPress » return last 10 posts from each post type in taxonomy archives

  • Hi,

    Having an issue with returning 10 posts from each CPT in a taxonomy archive.

    One CTP has more frequent posts, so I’d like to be able to return the 10 most recent posts from each CPT.

    Any ideas would be great.


Viewing 1 replies (of 1 total)
  • Hi BAC,

    Since this problem would be solved by using custom Query.
    Try given below query:

    $querystr = “SELECT post_title,name,post_date,post_content FROM wp_terms,wp_posts,wp_term_relationships where (wp_terms.term_id = wp_term_relationships.term_taxonomy_id and wp_term_relationships.object_id = wp_posts.ID) and wp_posts.post_status = ‘publish’ order by wp_posts.post_date DESC”;

    by using this query you will get all latest posts of each category.

    You can run this query on your phpmyadmin section.

    i hope this might help you.

Viewing 1 replies (of 1 total)
  • The topic ‘return last 10 posts from each post type in taxonomy archives’ is closed to new replies.