return last 10 posts from each post type in taxonomy archives (2 posts)

  1. BAC
    Posted 4 years ago #


    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.


  2. Shyam Kumar 2012
    Posted 4 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic