Viewing 3 replies - 1 through 3 (of 3 total)
  • List all posts where custom field car is equal to blue

    <?php
        $args=array(
          'meta_key' => 'car',
          'meta_value' => 'blue',
          'post_type' => 'post',
          'post_status' => 'publish',
          'posts_per_page' => -1,
          'caller_get_posts'=> 1
          );
        $my_query = null;
        $my_query = new WP_Query($args);
        if( $my_query->have_posts() ) {
          echo 'List of Posts';
          while ($my_query->have_posts()) : $my_query->the_post(); ?>
          <p><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></p>
           <?php
          endwhile;
        }
    wp_reset_query();  // Restore global post data stomped by the_post().
    ?>

    For more details see: query_posts(),

    Thread Starter microtag

    (@microtag)

    Great…
    Thanks a lot MichaelH.

    x others: add comma
    ‘meta_value’ => ‘blue’,

    Oops, fixed that.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Help with get_post_custom_values’ is closed to new replies.