Permalink URL connection between two custom types
Permalink URL connection between two custom types
Permalink URL connection between two custom types
WordPress taxonomy terms archive template help
I’ve found the solution by myself. In brief: use ‘order’ => ‘DESC’ The long story: Since I was doing the first page query via php (standard loop), and instead, the above is done via ajax, passing pagination (thus page 1 is php, the following are ajax), there was a mismatch about the order. I was … Read more
I know this is an old question, but it is a bit confusing and hopefully will help someone. The reason that `$query->set doesn’t work is because the query has already been parsed and now we need to also update the tax_query object also. Here is how I did it: function my_tax_query( $query ) { $package_id … Read more
No custom programming answer: A plugin like https://facetwp.com/ will allow you to set up filters as you have described. Custom programming answer: You can create a shortcode that renders fields for the user to check and submit. Then, attach a javascript submit handler to the form so that when the user checks a box or … Read more
function wpse340250_term_count( WP_Term $term, $post_type) { $q_args = [ ‘post_type’ => $post_type, ‘nopaging’ => true, // no limit, pagination ‘fields’ => ‘ids’, // only return post id’s instead of full WP_Post objects will speed up ‘tax_query’ => array( array( ‘taxonomy’ => $term->taxonomy, ‘field’ => ‘term_id’, ‘terms’ => $term->term_id, ), ), ]; $term_count = get_posts($q_args); return … Read more
Using the tax_query param in your args (and replacing the dot with a comma) should get you what you’re looking for: $args = array( ‘tax_query’ => array( ‘relation’ => ‘AND’, array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘fetch’, ), array( ‘taxonomy’ => ‘post_tag’, ‘field’ => ‘slug’, ‘terms’ => ‘agirt’, ) ) );
WP_Query only returns WP_Post objects for the results. To get the taxonomy terms for each post you need to use get_the_terms( $post, ‘recipe_categories’ ); for each post. This is because WP_Post represents each row of wp_posts, which does not include taxonomy information. The links between posts and terms is in the wp_term_relationships table.
It depends on the theme you’re using if it has the functionality to show the information. Usually, if you had a custom attribute using default WP, it will show those but for advance custom fields you might need to add the code into your theme. For example, the following code will help you to display … Read more
I solved it with this workaround. I created a new page (“Movies” with the URL domain.cc/movies) and added this via shortcode: <?php $taxonomy = ‘artists’; $tax_terms = get_terms( $taxonomy, array( ‘post_type’ => ‘artwork’, ‘orderby’ => ‘name’, ‘order’ => ‘ASC’ ) ); ?> <?php foreach ($tax_terms as $tax_term) { ?><div class=”artistslist”> <a href=”https://wordpress.stackexchange.com/<?php echo $taxonomy;?>/<?php echo … Read more