Loop for custom-post-type comparing taxonomy terms for “related” posts?

Change your $args array a little bit: $args = array( ‘post_type’ => array( ‘my_projects’ ), // it need to get the posts from this post_type ‘order’ => ‘DESC’, ‘posts_per_page’ => 5, ‘project_tags’ => $term // search taxonomy ); Other ways to search for taxonomy terms can be found here in the WordPress Codex pages. Answer … 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

Loop and add Specific Categories and Products Images

In your functions.php function show_all_thumbs() { global $post; $post = get_post($post); $images =& get_children( ‘post_type=attachment&post_mime_type=image&output=ARRAY_N&orderby=menu_order&order=ASC&post_parent=”.$post->post_parent); if($images) { foreach( $images as $imageID => $imagePost ){ unset($the_b_img); $the_b_img = wp_get_attachment_image($imageID, “thumbnail’, false); $thumblist .= ‘<a href=”‘.get_attachment_link($imageID).'”>’.$the_b_img.'</a>’; } } return $thumblist; } In your page template file: $loop = new WP_Query( array( ‘post_type’ => ‘demo’, // or whatever … Read more

Only display latest custom taxonomy post

You should save the ID of the first post in a variable (e.g $splash_post_id) and in the next loop, use “post__not_in” => $splash_post_id , in the $args array. $args = array( ‘post_type’ => ‘post’, ‘posts_per_page’ => ‘1’, ‘order_by’ => ‘date’, ‘order’ => ‘DESC’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘theme’, ‘field’ => ‘slug’, ‘terms’ => … Read more

Better in the long run to use post date or custom taxonomy to sort/separate posts by year?

I can’t see any practical reason to use a custom taxonomy here. You can already query posts by year using OOB query and archive stuff (see this Codex article about the “year” WP_Query parameter, and this one about the “yearly” mode for wp_get_archives()). If you’re asking purely about performance, I’d consider this kind of thing … Read more

loop over all custom taxonomies for current custom post type and their values

You can make a loop to retrieve the taxonomies: foreach( array(‘genre’, ‘rating’, ‘year’) as $taxo ){ #loop over each taxonomy $terms = get_the_terms( $post->ID , $taxo ); if( $terms && ! is_wp_error( $terms ) ){ echo $taxo . ‘: ‘; $myterm = array(); #get list of term names foreach($terms as $term){ $myterm[] = $term->name; } … Read more