Hi,
On looking at it properly, it doesn’t seem to be working. Maybe I should explain better and you can tell me if the code above will fit what I’m trying to do…
The two custom taxonomies that I have are called:
- interaction-media-types
- chapter
And the taxonomy terms are:
- interaction-media-types: activities-tools, audio, images, useful-web-links, videos
- chapter: 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13
Here is the [edited] code that you have provided me with, that I’m using:
function custom_has_chapter( $term ) {
return has_term( $term, 'chapter' );
}
function custom_has_media( $term ) {
return has_term( $term, 'interaction-media-types' );
}
My site is set up as a companion site for an ebook, and each page is associated with one of the 13 chapters. There is content at the bottom of the page for each chapter, which is split into a media type, showing in accordions. What I’m trying to do, is only make that accordion show if there is content associated with that chapter, and media type, ie. chapter: 1, media type: video has content in it, but it’s not currently showing anything (aside from a [/if] tag?) when using the following code:
[if custom_has_chapter="1"][if custom_has_media="video"]
[toggle title_open="Video" title_closed="Video" hide="yes" border="yes" style="default" excerpt_length="0" read_more_text="Read More" read_less_text="Read Less" include_excerpt_html="no"]
[raw]
[block class="table-of-interactions"]
[loop type="interaction" taxonomy="chapter" term="1" taxonomy_2="interaction-media-types" term_2="videos" compare="and"]
[fourcol_three]
<h4 style="margin-bottom: 10px;">[field title]</h4>
<p style="margin-bottom: 10px;">[field short_description format="true" length="365"]</p>
<a class="button small" href="[field url]">view</a>
[/fourcol_three][fourcol_one_last]
<a style="float: right;" title="[image-title]" href="[thumbnail]">[field image="thumbnail" size="thumbnail"]</a>
[/fourcol_one_last]
<hr />
[/loop]
[/block]
[/raw]
[/toggle]
[/if][/if]
Do you know where I’m going wrong? Many thanks for your help.