How to show all taxonomies within custom post type loop

I’m answering the <?php //echo tax names here ?>: In the loop, you can get the post terms using wp_get_post_terms(): while ($articles->have_posts() ): $articles->the_post(); $terms = wp_get_post_terms( get_the_ID(), ‘topic’, [ ‘fields’ => ‘names’ ] ); Then you can do something like echo implode( ‘ ‘, $terms ); inside the <div> tag: <div class=”masonry__item col-lg-3 col-md-6″ … Read more

Check if current user has a post and that post has any term/s from a specific custom taxonomy outside the loop

This can be done using WP_Query using author and tax_query. Something like this: $args = array( ‘post_type’ => ‘post’, ‘author’ => get_current_user_id(), ‘tax_query’ => array( array( ‘taxonomy’ => ‘custom-taxonomy’, ‘operator’ => ‘EXISTS’ ), ), ); $query = new WP_Query( $args ); And then check if posts are returned through this query. Please note that this … Read more

I am trying to get cutom post cout by month of current taxonmy term

you can do that with WordPress functions like that : $post_type = “tesekkur”; $timestamp_start = strtotime(“first day of next month -1 year midnight”); $start = date(“Y-m-d H:i:s”, $timestamp_start); $posts = get_posts([ “nopaging” => TRUE, “post_type” => $post_type, “date_query” => [ “after” => $start, ], ]); // sort by month $tab = []; foreach ($posts as … Read more

Query not work for current taxonomy

It looks like your query is for ALL posts in that post type as you are overwriting $posts when using $posts = get_posts(). You need to pass the Taxonomy parameter correctly as explained here like this: $args = array( ‘post_type’ => ‘post’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘people’, ‘field’ => ‘slug’, ‘terms’ => ‘bob’, … Read more

Iterating through Object Array to customise display of full custom taxonomy for custom post type

Instead of echoing right away, save the category names into an array, and then you can implode the array, which means output it with whatever separators between items you wish: <?php if(get_the_terms($post->ID, ‘kernal_category’, true)) { // Create an empty array $categories = []; $kernal_category = get_the_terms($post->ID, ‘kernal_category’, true); // Save each category to the array … Read more