Home Forums Front-end Issues Taxonomies not showing up when using Checkbox and Taxonomy field


Taxonomies not showing up when using Checkbox and Taxonomy field

  • Okay, this is my scenario:

    I have a taxonomy called comic_category.
    I’ve added two custom fields: border_color and tax_image
    I have them targeting “Taxonomy Term” is equal to “Comic Category”.

    Now I have a Front Page template and I want to show 3 of these taxonomies on the home page. So I’ve created a new Taxonomy field called home_categories.This field is targeting: “Page” is equal to “Home” and I’m using checkboxes to choose the three comic categories.

    The only problem, is nothing is showing up at all. I pretty sure my code is wonky. Here’s what I have:

    						$terms = get_field('home_categories');
    						$term_link = get_term_link( $term ); 
    						if( $terms ): ?>
    						<?php foreach( $terms as $term ): ?>
    								<div class="w-slide category-slide">
    		              <a class="w-inline-block" href="<?php echo $term_link ?>" data-ix="comic-blok">
    		                <div class="<?php echo get_field('border_color', $term); ?> category-block">
    		                  <div class="category-wrapper home"><img class="comic-image" src="<?php echo get_field('tax_image', $term); ?>" width="500" alt="<?php echo $term->name . ' category'; ?>">
    		              <?php echo '<div class="category-title">' . $term->name . '</div>'; ?>
    		            <?php endforeach; ?>
    							<?php endif; ?>
    							<?php wp_reset_query(); ?>
  • $term_link = get_term_link( $term ); could not work because $term is set inside the foreach loop. (dont think that is the main problem, but it would be one of the possibilities why it not work.)

    and you have “the same” a custom post that work with the others taxonomies?

Viewing 2 posts - 1 through 2 (of 2 total)

The topic ‘Taxonomies not showing up when using Checkbox and Taxonomy field’ is closed to new replies.