Using DP shortcode in a widget to dynamically show posts of current tax_term
-
I have a custom taxonomy “artists” that has artist names (e.g., Black Hibiscus) as terms (created with CPT UI). I wanted to customize the archive for the artists in that it will display posts categorized/tagged as Album Reviews and Track Reviews that pertain to them, if any.
There are hundreds of artists under the above taxonomy, so I decided to create a widget area on the taxonomy-artists.php template to put the Display Posts query parameters in a Custom HTML widget for each archive’s use.
This is my code:
<div id="track-and-album-rev" class="track-and-album-revs">
<h1>Album reviews</h1>
[display-posts taxonomy="artists" tax_term="current" tag="album-reviews" tax_relation="AND" image_size="thumbnail" include_author="true" include_date="true" date_format="F j, Y" orderby="date" wrapper="div" wrapper_class="display-posts-listing grid" meta_key="_thumbnail_id]
<!-- /wp:shortcode -->
<h1>Track reviews</h1>
[display-posts taxonomy="artists" tax_term="current" tag="track-reviews" tax_relation="AND" image_size="thumbnail" include_author="true" include_date="true" date_format="F j, Y" orderby="date" wrapper="div" wrapper_class="display-posts-listing grid" meta_key="_thumbnail_id]
<!-- /wp:shortcode --></div>However, this does not query only the posts with the current tax_term (e.g., /artists/black-hibiscus) that also have the given tag. Instead, it outputs all posts with the tag “album-reviews” and “track-reviews“, disregarding the taxonomy and tax_term rules.
Any advice is greatly appreciated.
The page I need help with: [log in to see the link]
- You must be logged in to reply to this topic.