How to display term description in empty terms archive?
How to display term description in empty terms archive?
How to display term description in empty terms archive?
Thanks for your help everybody. I was using a custom post type and forgot to include ‘post_type’=>’my_custom_post_type’ I finally got to the problem by doing a var_dump on the WP_Query object and looking at the SQL. Running the query directly on the database and picking through it, I eventually found my error.
Taxonomy page lead to 404 page on pagination
Here’s an alternative based on a single taxonomy.php file. In summary, call a function at the beginning of taxonomy.php. The function evaluates the taxonomy url and identifies which custom taxonomy (if any) applies. It then gets ALL the terms for that taxonomy (not just the one in the url), and then gets ALL the posts … Read more
Checked the source, and it seems the only way to get this done is filtering the output count for each term, you can achieve that by inserting this filter before your get_terms call. Note that this will now always display published item count so be careful on its usage. function get_terms_filter_published( $terms, $taxonomies, $args ) … Read more
I was able to make a ‘quick’ fix for this issue. The taxonomy we used is hierarchical, this was causing the edit tags and edit posts page to be very slow. Since it was a custom taxonomy where users are not allowed to edit the taxonomies or add new ones we decided to import the … Read more
You’re registering your taxonomy only if is_admin is true, so your taxonomy won’t exist for any non-admin request. Taxonomies (and post types) have to be registered on every request.
Try something like this: function custom_rewrite( $wp_rewrite ) { $feed_rules = array( ‘(.+)/blog/(.+)’ => ‘index.php?custom_tax=’.$wp_rewrite->preg_index(1).’&post_name=” . $wp_rewrite->preg_index(2) ); // ( array merge must be done this way, to ensure new rule comes first ) $wp_rewrite->rules = $feed_rules + $wp_rewrite->rules; } // refresh/flush permalinks in the dashboard if this is changed in any way add_filter( “generate_rewrite_rules’, … Read more
First, check your syntax and ensure any comparison operators, escapes, and quotes are correct, and the statements are written properly based on the examples given in the codex. w3schools’ PHP Tutorial is a great starting point. Also, if your question provided the code you attempted to use with a conditional tag, it would be beneficial … Read more
First of all, a taxonomy-{taxonomy}.php file is an Archive Template and not a good name for a custom template. So if you want to proceed with a custom template, try naming the file with something like template-cities.php and call the file to a Page. Otherwise, make a simple taxonomy-{taxonomy}.php archive template, and in your case … Read more