Create a custom taxonomy template that loops through child categories in term order?

Here’s what we’ve come up with so far, and there’s definitely room for improvement. remove_action( ‘genesis_loop’, ‘genesis_do_loop’ ); add_action( ‘genesis_loop’, ‘ahso_custom_taxonomy_archive_loop’ ); function ahso_custom_taxonomy_archive_loop() { global $wp_query; // globalize it. // get category ID $cat_id = $wp_query->get_queried_object_id(); // get current category // get all child categories $cat_args = array( ‘type’ => ‘products’, ‘child_of’ => $cat_id, … Read more

Variable Not Working Inside is_author() Array

You’ve converted $taxonomy_id_list to a comma separated string then shoved that string into an array. Your array now looks like array( “1,2,3,4” ); That is not going to match any author ID. You are misunderstanding what implode does. This–1,2,3,4,5,6,7— is a set of integers. If place in the array like this– array(1,2,3,4,5,6,7)— you get an … Read more

how to use tax_query to apply both terms or one if one is empty

Change your code with the following: $args = array( ‘post_type’ => ‘property’, ‘posts_per_page’ => 5000, ); $statuses = explode( ‘,’, $st_term_final_string); $terms = explode( ‘,’, $il_term_final_string ); if ( $statuses || $terms ) { $args[‘tax_query’] = array(); if ( $statuses ) { $args[‘tax_query’][] = array( ‘taxonomy’ => ‘Status’, ‘field’ => ‘slug’, ‘terms’ => $statuses ); … Read more

Single.php for Custom Post Type > Taxonomy > Term

You can load a different template for single posts via the single_template filter. Just use the has_term() function to check if the post has a specific term in your custom taxonomy. function wpa_107626_single_template( $single_template ) { // check if the post fits some condition if ( has_term( ‘term1’, ‘film_cat’ ) ) { $single_template = get_stylesheet_directory() … Read more

Add filter to Admin list for all custom post types by their custom taxonomies

I found a code which work only with single taxonomy and modified it. add_action( ‘restrict_manage_posts’, ‘my_restrict_manage_posts’ ); function my_restrict_manage_posts() { global $typenow, $post, $post_id; if( $typenow != “page” && $typenow != “post” ){ //get post type $post_type=get_query_var(‘post_type’); //get taxonomy associated with current post type $taxonomies = get_object_taxonomies($post_type); //in next loop add filter for tax if … Read more

Query Custom Post by taxonomy multiple categories

This should give you an OR relationship: $args[‘tax_query’] = array( array( ‘taxonomy’ => ‘category’, ‘field’ => ‘id’, ‘terms’ => array(1,2), ‘operator’ => ‘IN’ ) ); As would this: $args[‘tax_query’] = array( ‘relation’ => ‘OR’, array( ‘taxonomy’ => ‘project-type’, ‘field’ => ‘id’, ‘terms’ => array(1) ), array( ‘taxonomy’ => ‘project-type’, ‘field’ => ‘id’, ‘terms’ => array(2) … Read more