Custom Post Type Category List & Post Count
$tax_term->count should contain the number of posts in the category. You may need to add the $args parameter if you want to include subcategory counts. Docs: get_terms()
$tax_term->count should contain the number of posts in the category. You may need to add the $args parameter if you want to include subcategory counts. Docs: get_terms()
First get a list of categories and a list of locations. Then loop through each category. Within each category loop through the list of locations and query posts that have the current category and the current location and output the list: $categories = get_terms( array( ‘taxonomy’ => ‘shop_category’, ) ); $locations = get_terms( array( ‘taxonomy’ … Read more
Ok, to work around this and do what i need to do i installed a plugin (Custom Post Type Permalinks by Toto_unit) to add custom post types and custom taxonomies to my permalink structure. For my conditionals i’m using $_SERVER[‘HTTP_HOST’] == to check the current url. Hopefully this helps someone else.
Like Rarst, I am confused what you want to output, the taxonomy or the terms of that taxonomy. Taxonomy can be output for example if you make a template file with the name of that taxonomy: taxonomy-name.php the title of the taxonomy then becomes: <h1 class=”page-title”><<?php $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ … Read more
Solution I have figured it out with the help of these posts by Jan Fabry -> https://wordpress.stackexchange.com/a/5478/10350 https://wordpress.stackexchange.com/a/22490/10350 I have set up the custom post type as follows -> Custom post type (register_post_type) -> “product” Taxonomy (register_taxonomy) -> “product-type” Back-end function I rewrite the permalink structure that is saved in the back-end, so that the … Read more
Just clarifying, what was pointed out by Parst with a working example of a custom taxonomy registration code: $labels = array( ‘name’ => _x( ‘Issue numbers’, ‘taxonomy general name’, ‘sascha_setup_post_type’ ), ‘singular_name’ => _x( ‘Issue number’, ‘taxonomy singular name’, ‘sascha_setup_post_type’ ), ‘search_items’ => __( ‘Search issues’, ‘sascha_setup_post_type’ ), ‘all_items’ => __( ‘All issue numbers’, ‘sascha_setup_post_type’ … Read more
Hi @Edward: This is not a generic solution but will probably solve your needs. If you want to get rid of the ‘| Portfolio Categories’ from your site’s title just hook the ‘wp_title’ filter in your theme’s functions.php file and remove that from the title string. Copy this code to the bottom of that file … Read more
Taxonomies are not child of each other unlike terms, which can be. Take a look at this flowchart: Model is a child of Make, and should not be registered as a new taxonomy. What you are trying to do, is something like setting Ford as a child of Honda, which is not right. Instead, register … Read more
Ok so after posting the question an option to view another similar question appeared. So here is the answer if somebody is trying to do the same thing. //Using WordPress Pre-Get filter to order the custom taxonomy by custom field function customize_customtaxonomy_archive_display ( $query ) { if (($query->is_main_query()) && (is_tax(‘custom-taxonomy’))) $query->set( ‘post_type’, ‘your-post-type’ ); $query->set( … Read more
As I have stated in comments, this will take some work. In short, you will need the following: Get all the terms from the style taxonomy. Here we would only want the term ids Get the current tax_query from the colour taxonomy. Use each term from the style taxonomy and create a new tax_query to … Read more