Grandchild Term Things Grandfather Term is It’s Parent

Use get_terms() and the parent argument. ‘parent’ (int|string) Parent term ID to retrieve direct-child terms of. $parent_term_id = 123; $direct_child_terms = get_terms( array( ‘taxonomy’ => ‘[taxonomy]’, ‘parent’ => $parent_term_id, ) ); Don’t forget to replace [taxonomy] with whatever the taxonomy is; e.g., post_tag, product_cat, etc. Additional arguments for further customization here.

How to display child categories of all parent category within a singe loop?

Here you go: $args = array( ‘post_type’ => ‘listing’, ‘order’ => ‘ASC’, ‘hide_empty’ => false, ‘parent’ => 0, ); $listCatTerms = get_terms( ‘listing-category’,$args); if ( ! empty( $listCatTerms ) && ! is_wp_error( $listCatTerms ) ){ echo “<ul>”; foreach ( $listCatTerms as $term ) { echo ‘<li>’.$term->name.'</li>’; $child_terms = get_categories( array( ‘parent’ => $term->term_id, ‘hide_empty’ => … Read more

How to remove one specific category (uncategorized) from post permalinks

Adding this kind of rewrite rule is not a problem, you have to add only this code. /** * Add custom rewrite rule to handle posts with and without category prefix. * * Remember to flush rewrite rules to apply changes. */ function wpse_288675_add_post_handling_without_category_prefix() { add_rewrite_rule(‘([^/]+)(?:/([0-9]+))?/?$’, ‘index.php?name=$matches[1]&page=$matches[2]’, ‘top’); } These rewrite rules are working on … Read more

Show parent categories and sub categories but not grand children categories

In the single post you can get the parent category like this $category = wp_get_object_terms(get_the_ID(), ‘category’, array(‘parent’=>0)); $args = array( ‘show_count’ => false, ‘hide_empty’ => true, ‘title_li’ => ”, ‘show_option_none’ => ”, ‘echo’ => false, ‘depth’ => 1 ); $args[‘child_of’] = $category[0]->term_id; // Get the category list $categories_list = wp_list_categories( $args ); if ( $categories_list … Read more

Portfolio Filter Buttons Wont Work

Looks like there maybe a problem with your plugins.js on line 35 according to my console. I’m getting the error TypeError: portfolioContainer.imagesLoaded is not a function. The code in question is: if (jQuery().isotope){ var portfolioContainer = jQuery(‘.w-portfolio.type_sortable .w-portfolio-list-h’); if (portfolioContainer) { portfolioContainer.imagesLoaded(function(){ portfolioContainer.isotope({ itemSelector : ‘.w-portfolio-item’, layoutMode : ‘fitRows’ }); }); jQuery(‘.w-filters-item’).each(function() { var item … Read more