Make custom post type display with custom taxonomy in url
Make custom post type display with custom taxonomy in url
Make custom post type display with custom taxonomy in url
Guest author – URL, base and custom taxonomy – working but unstable
Group custom taxonomies based on tags contained in their posts
List posts grouped by children of a custom taxonomy
after_setup_theme fires before init, so in this case the code is trying to insert a term into your taxonomy before WordPress is aware that your taxonomy exists! Generally, I feel like init is a better location for both pieces of functionality unless you have a reason to do otherwise. But however you resolve it, if … Read more
A simple function to count posts did the trick, but this is one more request in DB : function count_posts_in_cat_by_custom_term( $category_ID, $custom_taxonomy_name, $custom_term_id ){ $args = array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ‘posts_per_page’ => -1, ‘category’ => $category_ID, ‘tax_query’ => [ [ ‘taxonomy’ => $custom_taxonomy_name, ‘fields’=>’term_id’, ‘terms’ => $custom_term_id, ] ] ); $posts = … Read more
This issue shouldn’t happen if you’re using the classic editor, however, if you’re using the block/Gutenberg editor which uses the REST API, then that issue can be fixed by using the wp_after_insert_post hook instead. Excerpt from https://make.wordpress.org/core/2020/11/20/new-action-wp_after_insert_post-in-wordpress-5-6/: The new action wp_after_insert_post has been added to WordPress 5.6 to allow theme and plugin developers to run … Read more
Instead of checking against the template, you should use is_tax() which is one of the conditional tags in WordPress. So in your function, you just need to use is_tax( ‘state’ ) in place of is_page_template( ‘taxonomy-state.php’), and your asset would only be loaded on the archive page for your custom state taxonomy.
Woocommerce – how to get and display selected variations on single product page
Try this, you can’t just throw a conditional block inside an echo statement. If you really need to it has to be a shorthand if-else, but for visual purposes I have put the statement outside the loop: $taxonomy = ‘product-categories’; $tax_terms = get_terms( $taxonomy ); foreach($tax_terms as $tax_term) { $terms = apply_filters( ‘product-categories-images-get-terms’, ” ); … Read more