Taxonomies & Custom Taxonomies

Standard Taxonomies like posts, tags and post formats and custom Taxonomies can be handled by featured-image-pro. Use the shortcode generator to select taxonomy id’s.

Normally, you only need two fields.

taxonomies

a comma delimited list of taxonomies

taxonomy_relation

defaults to ‘OR’. Possible values are ‘AND’, ‘OR’. Do not use with a single inner taxonomy array. When more than one taxonomy is being queried, determines if retrieved posts should match all taxonomy terms or can match or any. Combine with [taxonomyname]_operator for more complicated queries.

[taxonomyname]_terms

comma delimited list of taxonomy terms for the specified taxonomy. The shortcode generator only generates id’s. If the taxonomy field is ‘slug’ you can manually enter the slugs here.

As an example: [featured_image_pro post_type='galleries' taxonomies='gallery_category' gallery_terms='1,2,3'] which will include gallery posts where the custom taxonomy gallery_category id is 1, 2, or 3.

Additional options are not generated by the shortcode generator and need to be added by hand.

[taxonomyname]_field

possible values are ‘term_id’, ‘name’, ‘slug’ or ‘term_taxonomy_id’. Default value is ‘term_id’

 

[taxonomyname]_include_children

(boolean) – Whether or not to include children for hierarchical taxonomies. Defaults to true.

[taxonomyname]_operator] (string) – Operator to test. Possible values are ‘IN’, ‘NOT IN’, ‘AND’, ‘EXISTS’ and ‘NOT EXISTS’. Default value is ‘IN’.

Retrieve posts that have categories in terms with id’s 4 or 2

 [featured_image_pro category_terms='4,2' category_field='id' taxonomies='category' posts_per_page=999 subcaption1='category' subcaptiontitle1='Categories:']

Retrieve posts that have a term with the id of 198

[featured_image_pro post_tag_terms='198' post_tag_field='id' posts_per_page=999 taxonomies='post_tag' subcaption1=tag subcaptiontitle1='Tags:']

 

Retrieve posts that have either categories with term id 4 or 2 OR tag with an id of 198

[featured_image_pro post_tag_terms='198' posts_per_page=999 post_tag_field='id' , category_terms='4,2' category_field='id', taxonomies='category, post_tag']

 

Retrieve posts that have BOTH categories with term id 4 or 2 AND tag with an id of 198

[featured_image_pro post_tag_terms='198' post_tag_field='id' posts_per_page=999 category_terms='4,2' category_field='id', taxonomies='category, post_tag' taxonomy_relation='AND' posts_per_page=999]

View images from the media library using a custom Taxonomy

[featured_image_pro post_type='attachment' attachment_category_terms='297,298' attachment_category_field='id' taxonomies='attachment_category' posts_per_page=999]

 

Leave a Reply

Your email address will not be published. Required fields are marked *