• smrdo

    (@smrdo)


    Hi Ive the following code for a single Taxonomy term template, its all working fine, however i’d like to adapt it somehow to get the argument ‘term’ dynamically, so get the current term, update the array and limit the loop to that term.

    <?php
    $args=array(
      'taxonomy' => 'portfolio_cat',
      'term' => 'theatre',
      'post_type' => 'cc_porfolio',
      'posts_per_page' => -1,
      'caller_get_posts'=> 1
    );
    $my_query = null;
    $my_query = new WP_Query($args);
    if( $my_query->have_posts() ) { ?>
    <div id="owl-example" class="owl-carousel">
      <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
    //my loop contnet
     <?php
      endwhile;
    }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>
    </div>

    hope this makes sense, many thanks in advance

  • The topic ‘dynamicall populate a WP-Query Args’ is closed to new replies.