Display a Custom Post Type within another with hierarchically slug

Base on comment, you need to create a little function to display these related posts. You can do it in different ways, here is an simple example by adding your own action to the template. in your template file place where you want to show related lessons do_action(‘related_lesson’); In functions.php function get_related_lesson(){ global $post; $args … Read more

Display all posts from single taxonomy term

You have a problem with the tax_query arrays array( ‘post_type’ => ‘attorneys’, ‘tax_query’ => array( ‘taxonomy’ => ‘practice-areas’, ‘field’ => ‘slug’, ‘terms’ => ‘appeals’, ) ) The tax_query parameter in $loop must look like this: $loop = new WP_Query( array( ‘post_type’ => ‘attorneys’, ‘tax_query’ => array( array( ‘taxonomy’ => ‘practice-areas’, ‘field’ => ‘term_id’, ‘terms’ => … Read more

Only seems to be displaying one child when there are supposed to be multiple

Assuming you want to show the terms of just one taxonomy at a time, then this will produce what you’re looking for: function my_theme_get_child_terms(){ $return = ”; $current_term = get_queried_object()->term_id; $term_info = get_term($current_term); $sub_categories = get_term_children( $current_term, $term_info->taxonomy ); $return .= ‘<h2>’ . $term_info->taxonomy . ‘</h2><ul>’; foreach ( $sub_categories as $cat ) { $term = … Read more

Taxonomy’s title

This piece of code will return all categories assigned to current product. global $post; $terms = get_the_terms( $post->ID, ‘product_cat’ ); foreach ($terms as $term) { $cat_name .= $term->name.’, ‘; break; } echo $cat_name; add this code inside single-product.php Hope this help !

Pretty permalink structure with multiple (AND OR) taxonomies

In general there are the following considerations and choices: Does WP do this already? Best case scenario when use case is reasonably supported by core natively, just configure to that. Are “pretty” permalinks critical or optional? In general GET queries are much more easier to work with, at the cost of being “ugly”. Pretty permalinks … Read more