Forum Replies Created

Viewing 1 replies (of 1 total)
  • Thread Starter habmania

    (@habmania)

    Figured out a simpler solution. I can repeat this as many times as I want throughout the same page! Hope it helps someone.

    <?php
                                    $args = array(
                                    'post_type' => 'recipes', //name of custom post type
                                    'tax_query' => array(
                                        array(
                                            'taxonomy' => 'custom_cat',  //name of custom category
                                            'field' => 'slug',
                                            'terms' => 'cottage-cheese', //name of category
                                        ),
                                    ),
                                );
    
                            $query = new WP_Query( $args );
    
        if( $query->have_posts() ) {
          echo '<ul class="recipe-list">';
          while ($query->have_posts()) {
                    $query->the_post();
                    echo '<li>' . get_the_title() . '</li>';
                    }
    
                    echo '</ul>';
                    wp_reset_query();
            } ?>
Viewing 1 replies (of 1 total)