Tag Info

New answers tagged

-2

use this code for access first texonomy from custom post type in wordpress how about use get_the_terms() function? please try this code $works = get_the_terms( $post->ID, 'work' ); $director = $works[0]; // print object from first director print_r($director); // or get the director name echo $director->name;


0

how about use get_the_terms() function? please try this code $directores = get_the_terms( $post->ID, 'directores' ); $director = $directores[0]; // print object from first director print_r($director); // or get the director name echo $director->name;


1

As already hinted by @Milo, check if you have terms before appending your tax_query You can try the following: (Requires PHP 5.4+ due to short array syntax, revert to old syntax if necessary) $args = [ 'post_type' => 'product', 'posts_per_page' => 15, 'paged' => $paged, 'post__not_in' => $exclude, 's' => $filter, ]; // ...


0

The category parameters does not work with custom taxonomies. You need to use a tax_query instead. In your current code, replace (which is in any case also wrongly used, category_name takes the slug, not name) 'category_name' => $category->name with 'post_type' => 'case-studies', 'tax_query' => array( array( 'taxonomy' => $tax ...


0

This code display all posts of all categories of location taxonomy for custom post type testaismgallery. $args = array( 'number' => $number, 'hide_empty' => $hide_empty, 'include' => $ids ); $custom_categories = get_terms( 'location', $args ); foreach ( $custom_categories as $catterm){ $arg = ...



Top 50 recent answers are included