Get all posts for custom taxonomy term

If you only need to display posts assigned to a taxonomy (just a list of posts from each term in your taxonomy without displaying term information) Get only terms IDs: $custom_terms = get_terms( array( ‘taxonomy’ => ‘how-to-guide-type’, //your taxonomy ‘hide_empty’ => true, //ignore terms without posts ‘fields’ => ‘ids’ //return only terms ids )); Now … Read more

How to show children terms even if they are empty

Ok, I think I got it! 😀 After some research in theme functions how taxonomy hierarchy structure is done I modified the code as below (don’t know if it’s coded good but it works): /* * Display filter taxonomies */ static public function taxonomy_listing( $name, $terms, $taxonomy, $selected_term, $hide_empty = false ){ $search_more_less = adifier_get_option( … Read more

I want to customize the_posts_navigation function by replacing prev and next with images

You can put svg text right in the prev_text and next_text. To make it a little more readable here I’ve broken it up and prepared the SVG markup first. I am only show you the “prev” link but the “next” would work the same way. $prev_label = “<span class=”cover–nav-label”>” . _e(‘Recette précédente’, ‘marque’) . “</span>”; … Read more

I want to change the slugs of my terms dynamically

As far as I got you right, the following code is all you need to solve this. function my_function( $post_id ){ if ( ! wp_is_post_revision( $post_id ) ){ $post = get_post( $post_id ); $my_args = array( ‘ID’ => $post_id, ‘post_name’ => ” ); // unhook this function so it doesn’t loop infinitely remove_action( ‘save_post’, ‘my_function’ … Read more

Order get_terms by multiple values

WP_Term_Query, which powers get_terms(), does not support ordering by multiple properties the same way WP_Query does. But, since you don’t need to worry about pagination, you’ll be able to achieve the result you want by sorting the results after querying them: $allcities = get_terms( array( ‘taxonomy’ => ‘city’, ‘hide_empty’ => false, ) ); usort( $allcities, … Read more