ACF – Retrieve custom taxonomy from a relationship field

I managed to solve my issue by looping through a get_the_terms() function. In my case, I’ve also created a shortcode. function display_taxonomy() { $prognoses = get_field(‘prognosis’); ob_start(); if( $prognoses ): foreach( $prognoses as $prognosis ): $terms = get_the_terms( $prognosis->ID , ‘my_custom_taxonomy’ ); foreach ( $terms as $term ): echo $term->name; endforeach; endforeach; endif; return ob_get_clean(); … Read more

CPT archive page – show one post from each taxonomy term

So I went ahead and did the multiple loop thing, as I had done before. I’m always interested in seemingly cleaner/simpler solutions, but sometimes you just have to keep moving. This is the code I’m using: <?php $args = array( ‘post_type’ => ‘projects’, ‘project_category’ => ‘websites’, ‘orderby’ => ‘menu_order’, ‘showposts’ => 1 ); $posts = … Read more

How to display posttypes and taxonomy in standard posts, not in a separate label?

when you register a taxonomy, the second argument is the post type it is available for: register_taxonomy( $taxonomy, $object_type, $args ); if you want the taxonomy to work for a custom type as well as standard posts, you can pass an array of types: $object_type = array( ‘your_custom_type’, ‘post’ ); alternately, you can use register_taxonomy_for_object_type: … Read more

Tax_Query using WP_Query not working

You aren’t looping through the results. Here is your code: $m = new WP_Query( $myquery ); if ( $m->have_posts() ) : $m->the_post();?> <ul><li <?php post_class();?>><a href=”https://wordpress.stackexchange.com/questions/83409/<?php the_permalink(); ?>”><?php the_title(); ?></a></li></ul> <?php endif; wp_reset_postdata(); ?> There is no Loop. You just check for the existence of posts, echo some information about the first one and quit. … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)