Problem with Query on Taxonomy

This should works. $args = array( ‘taxonomy’ => ‘your_taxonmy_name’, // replace with your taxonomy name ); $categories = get_categories( $args ); $ids = array(); // lets get all post IDs foreach ( $categories as $category ) { $args = array( ‘cat’ => $category->term_id, ‘post_type’ => ‘homepage’, // your post type ‘posts_per_page’ => ‘1’, ‘post__not_in’ => … Read more

Display latest x posts from all categories in Custom Post Type/Taxonomy

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 ‘terms’ => $category->term_id, ‘include_children’ => false … Read more

Post loop for all taxonomy terms

You can get all the terms in a custom taxonomy using the following code: $terms = get_terms( ‘development-category’ ); if ( ! empty( $terms ) && ! is_wp_error( $terms ) ){ foreach ( $terms as $term ) { $loop = new WP_Query( array( ‘development-category’ => $term->slug, ‘post_type’ => ‘developments’ ) ); ?> …. } }

category image taxonomy

Found a solution: <?php $cat = get_the_category(); $category_id = $cat[0]->term_id; foreach (get_the_category() as $cat) : $attachmentId = get_option(“category_image_{$category_id}”, ‘null’); $imageArr = wp_get_attachment_image_src( $attachmentId, ‘medium’ ); $imageURL = $imageArr[0]; echo ‘<img src=”‘ . $imageURL . ‘” />’; endforeach; ?>