Display term picture of each post in a loop

So, I finally found the solution. Maybe there are better ways to arrive to the same result, but at least, it works. Here it goes: <?php $terms = get_the_terms( $post->ID , ‘issues’ ); foreach ($terms as $key) : $size = “article-small”; $image_id = get_field(“image_tag”, $key, false); $image = wp_get_attachment_image_src($image_id, $size); ?> <img src=”<?php echo $image[0]; … Read more

WordPress REST API – get custom taxonomy category posts

You need to first register rest route for your custom taxonomy i.e. my_portfolio add_filter( ‘register_taxonomy_args’, ‘my_portfolio_taxonomy’, 10, 2 ); function my_portfolio_taxonomy( $args, $taxonomy_name ) { if ( ‘my_portfolio’ === $taxonomy_name ) { $args[‘show_in_rest’] = true; // Optionally customize the rest_base or rest_controller_class $args[‘rest_base’] = ‘my-portfolio’; $args[‘rest_controller_class’] = ‘WP_REST_Terms_Controller’; } return $args; } After that you … Read more