This week only. Pastebin PRO Accounts Christmas Special! Don't miss out!Want more features on Pastebin? Sign Up, it's FREE!
Guest

Filtered CPT Query in WordPress

By: a guest on Aug 1st, 2013  |  syntax: PHP  |  size: 0.37 KB  |  views: 40  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php
  2.         $args = array(
  3.                 'post_type' => 'offers',
  4.                 'meta_query' => array(
  5.                         array(
  6.                                 'key' => 'offer-status',
  7.                                  'value' => 'Active'
  8.                         )
  9.                 ),
  10.                 'posts_per_page' => '3'
  11.         );
  12.         $offers_query = new WP_Query( $args );
  13. ?>
  14. <?php if ( $offers_query->have_posts() ) : while ( $offers_query->have_posts() ) : $offers_query->the_post(); ?>
clone this paste RAW Paste Data