Field Not Showing Correctly on Empty Taxonomy Term
-
I have a field associated with taxonomy term ‘category’ that displays content on the category’s archive page. On archive pages where there are posts associated with that category, the field displays the content correctly. However, when viewing a category that has no posts associated with it, the field displays the incorrect content. I’m not even sure how it’s picking up the incorrect content.
Below is the code I have on my category.php theme page:
if ( is_category() ) { $curcategory = get_the_category(); $title = single_cat_title( '', false ); $subtitle = category_description(); $curcatID = intval($curcategory[0]->term_id); $taxonomy = 'category'; $issuu_embedcode = get_field('issuu_embed_code', $taxonomy . '_' . $curcatID); } ?> <h1 class="page-title title title-large"><?php echo $title; ?></h1> <?php if ( ! empty( $subtitle ) ): ?> <h2 class="subtitle"><?php echo $subtitle; ?></h2> <?php endif ?> <div align="center" style="margin-left: 0; margin-right: 0;"><?php echo $issuu_embedcode; ?></div>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Field Not Showing Correctly on Empty Taxonomy Term’ is closed to new replies.