Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Only Display posts with specific custom field value within string or array Reply To: Only Display posts with specific custom field value within string or array

#145643
Esquivelia
Participant

Senff,

Thanks man! Working now!

    <?php
        $args = array( 'post_type' => 'ait-dir-item', 
                       'meta_query' => array(
                            array(
                                'key' => 'location',
                                'value' => 'annapolis'
                            ),
                            array(
                                'key' => 'item_tags',
                                'value' => 'Non-Marine',
                                'compare' => 'LIKE',
                            )
                        ),
                        'orderby' => 'title', 
                        'order' => 'ASC',
                       'posts_per_page' => 300 );
        $loop = new WP_Query( $args );
        while ( $loop->have_posts() ) : $loop->the_post();
            the_title('<h3 class="entry-title">', '</h3>');
            echo '<div class="entry-content">';
            the_content();
            echo '</div>';
        endwhile;
    ?>