BuddyDev

Shortcode to List Taxonomy/Custom Post Type Posts List

Today, I am releasing the taxonomy posts plugin and hope that It will help some of you. I was working on the new docs section for BuddyDev( has yet to go live ) and the one thing I needed was some code to list all posts from categories in post/page to create Table of content. I looked but could not find a simple plugin to do that, so wrote one.

What you can do with this plugin:-

  • List all posts from a category inside  a post
  • List limited no. of posts from a category inside a post
  • List all custom post types inside a post
  • List all attachment(currently, lists all attachments and is not much helpful)
  • List all/limited number of posts from any taxonomy
  • Lists all/limited no. of posts from any taxonomy, custom post type

My goal with this plugin was to make it super simple to use. Here is how do you use it. You can use any of the three shortcodes whichever you like to list the posts  [category_toc], [term_toc] or [taxonomy-posts-list] .  I personally prefer the first one for post categories and last one while using custom taxonomies. These three are exactly same and just aliases. I was not sure which one sounds better, so created three aliases. Here are the various options available with the shortcode.

Shortcode Options:-

  • max: [optional] maximum no of posts to list, you can use it like max='5' to list 5 posts. If you do not specify, all posts for the taxonomy/post type will be listed depending on below conditions
  • term: [optional] The category or taxonomy term slug. eg. term='love' to find all the posts tagged in category love. If you do not specify a term, the first term from the current post will be taken.
  • taxonomy: [optional] You can specify custom taxonomies like events like this taxonomy='events', By default, the taxonomy is set to be post categories.
  • post_type: [optional] You can specify the posts from which post type which should be listed. By default, It is set to the post type of current post.
  • post_status: [optional], You can specify the
  • wrapper : [optional] default value is 'ol' for numbered list, use 'ul' for un ordered list

Screenshot:-

Since We are using it in our own project, More enhancements will com in future.

Download & Installation:-

https://buddydev.com/plugins/taxonomy-posts-list/

Do you plan to use this plugin? Do you think we should add some more feature? I am looking forward to see your thoughts in the comments.

PS: There is something awesome for BuddyPress coming tomorrow. Don't forget to check our blog tomorrow 🙂

3 Responses to Shortcode to List Taxonomy/Custom Post Type Posts List

  • Great plugin 🙂

  • Like the look of this. What would be really nice would be being able to list posts from the logged in user or from a specific author.