Display 3 levels of categories on page

Try this: <?php $paged = ( get_query_var( ‘paged’ ) ) ? get_query_var(‘paged’) : 1; $cat_id = 42; $child_categories=get_categories( array( ‘parent’ => $cat_id ) ); foreach ( $child_categories as $child ) { ?> <!– loop through child categories and make columns –> <div class=”col-sm-4″> <!– category title –> <?php $string = $child->cat_name; $className = str_replace(‘ ‘, … Read more

custom post type single page

If you have a single page already, you shouldn’t be using a wp_query as well. Instead of these lines: <?php $args = array(‘post_type’ => ‘listing’); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); ?> Use these lines: <?php // Start the loop. while ( have_posts() ) : the_post(); ?>

WordPress trying to query two custom types to get child from the parent

So I was finally able to find what I needed: $loop2 = new WP_Query([ ‘post_type’ => ‘service’, ‘numberposts’ => -1, ‘meta_key’ => ‘_wpcf_belongs_service-category_id’, ‘toolset_relationships’ => [ ‘role’ => ‘child’, ‘related_to’ => $parent_id, ‘relationship’ => [‘service-category’, ‘service’] ] ]); https://wp-types.com/documentation/customizing-sites-using-php/displaying-child-posts/