kisabelle
1/16/2014 - 6:16 PM

WP Query / WP_Query

WP Query / WP_Query

<?php

  $my_query = new WP_query( 
  array(
    'posts_per_page'    =>    10, // ??
    'post_type'            =>    'your-post-type', // custom post type
    'paged' => get_query_var('paged'),
    'meta_key' => 'your-meta-key', // custom field slug
    'orderby' =>  'meta_value title',
    'order' => ASC,
    'meta_value' => $meta_value, // custom field value
    'custom-tax-1' => $desired_tax_1_value, // custom taxonomy
    'custom-tax-2' => $desired_tax_2_value, // custom taxonomy
    )
  );
?>

<?php if ($my_query->have_posts()): ?>

  <?php while ($my_query->have_posts()) : $my_query->the_post(); ?>
  

Tag Parameters 

tag (string) - use tag slug.
tag_id (int) - use tag id.
tag__and (array) - use tag ids.
tag__in (array) - use tag ids.
tag__not_in (array) - use tag ids.
tag_slug__and (array) - use tag slugs.
tag_slug__in (array) - use tag slugs.