Continuing from my earlier article titled How to create a custom widget that displays value of a custom field in WordPress, here I am going to share how I have set up a custom widget that pulls a fixed number of Custom Post Type entries that have been categorized under the same category/categories that the current Post belongs to (on single Posts).
Appearance > Widgets:
On a single Post:
If no published CPT entry exists that belongs to the same category, widget will not appear (including its markup) in the sidebar.
wp-content/plugins/core-functionality/lib/widgets/widget-related-case-studies.php:
To view the full content, please sign up for the membership.
Already a member? Log in below or here.
Hi, I use two custom parent taxonomy (events / centers), with their respective child taxonomy ( event1, event2… / center1, center2…). What should I change to display posts from the same child taxonomy as the current post? (One post can use a events child taxonomy, a centers child taxonomy, or one of each)
Hope you can help, Thanks!
I just want it to match the taxonomies, i don’t use any category.