Hi,
There isn’t a direct ability to do this provided by the plugin. If I’m understanding correctly, you are showing posts in your list and want each post title to be coloured by the post’s associated terms.
You could try adding a template into your childtheme called a-z-listing.php copied from wp-content/plugins/a-z-listing/templates/a-z-listing.php. Within this file you’ll want to try using get_the_item_object() to load the $post variable inside the while( $a_z_query->have_items() ) loop. Then you can use has_term() from WordPress core to match against your list for colouring:
...
<?php
while( $a_z_query->have_items() ) :
$a_z_query->the_item();
$post = $a_z_query->get_the_item_object();
if ( has_term( 'red-term-slug', 'taxonomy-slug', $post ) {
print '<li class="red">';
} elseif ( has_term( 'green-term-slug', 'taxonomy-slug', $post ) ) {
print '<li class="green">';
} else {
print '<li class="boring colourless">';
}
?>
<a href="<?php $a_z_query->the_permalink(); ?>">
<?php $a_z_query->the_title(); ?>
</a>
</li>
<?php endwhile; ?>
...
-
This reply was modified 6 years, 10 months ago by
Dani Llewellyn. Reason: fix mistaken use of get_the_terms() - better to use has_term()
Thread Starter
Chris
(@christof15)
Thanks a lot!! I’ll give this a go 🙂