Support

Account

Home Forums General Issues Insert Cat ID into Query Reply To: Insert Cat ID into Query

  • I think we’re closer, but no cigar 🙁 but I’ve also moved on to wp-query. I have it set up, but it’s still not pulling the category for the query. Here is my complete loop:

      <?php if( have_rows('parts_table') ): ?>
    
        <?php while( have_rows('parts_table') ): the_row(); ?>    
        
    
    <?php
    $catquery = new WP_Query( 'order=ASC&orderby=meta_value&meta_key=weight_(lbs.)&showposts=200&cat='.get_sub_field('part_category').'&post_type=sweeps' ); ?>
    <table>
    <tr><td>Part Number</td><td>Description</td><td>Weight (lbs.)</td>
    <?php while($catquery->have_posts()) : $catquery->the_post();
    ?>
    
                    <tr>
                        <td>
                        <?php the_field('part_number'); ?>
                        </td>
                        <td>
                        <?php the_field('description'); ?>
                        </td>
                        <td>
                        <?php the_field('weight_(lbs.)'); ?>
                        </td>            
                    </tr>
                
    
    <?php endwhile; ?>
          <?php wp_reset_query(); ?>
        </table> 
          <?php endwhile;?>
        <?php endif; ?>

    So there is my loop. If I manually enter a cat id it works, but it won’t pull my ACF field. Thanks so far!