Custom taxonomy query showing more than 4 posts

This is why code indentation is so important! Your posts_per_page argument is actually part of your tax_query: ‘post_type’ => ‘regularproducts’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘products-category’, ‘field’ => ‘slug’, ‘terms’ => $course_terms, //the taxonomy terms I’d like to dynamically query ‘posts_per_page’ => ‘4’ ), ), ‘orderby’ => ‘title’, Instead, you should have: $wp_query = … Read more

Custom Taxonomy Not Saving in Front End Post

I figured this out after much trial and error. Made some slight changes to the $new_post array. else if( !$error_msg && ‘POST’ == $_SERVER[‘REQUEST_METHOD’] && !empty( $_POST[‘action’] ) && $_POST[‘action’] == “new_post”){ $new_post = array( ‘post_title’ => $title, ‘post_content’ => $description, ‘post_category’ => array($_POST[‘cat’]), // Usable for custom taxonomies too ‘tags_input’ => array($tags), ‘tax_input’ => … Read more

Taxonomy term count

You can use WP_Query Methods and Properties to accomplish this. $wp_query->found_posts will return the amount of posts within the term while $wp_query->queried_object->name will return the name of the term currently displayed. You can now just paste all these together to display 18 free resources $taxcount = $wp_query->found_posts; $taxname = $wp_query->queried_object->name; printf(__( ‘%s %s resources’ ), … Read more

Add custom taxonomy as a css class

Your code shows how it fetches posts, but not, how it fetches the $term. On a proper development environment (WP_DEBUG is set to TRUE) this code should trigger a notice, that $term is unknown at this point. However, I suggest to use the template function post_class() to display relevant information of the post as HTML … Read more

Show only first child in dropdown

get_term_children() is by purpose recursive, it will always get all children and is not configurable. get_terms() is more generic function for terms retrieval. Using parent argument for it will only retrieve one level of children (while child_of will retrieve all). See linked documentation in Codex for details.