I am able to query by meta_key but when I introduce the meta_value then nothing shows in the query.
The following code works:
<?php
$listingPages = get_posts(
array(
'meta_key' => 'select_attorney_type',
'post_type' => 'page',
'post_status' => 'publish',
'orderby' => 'menu_order',
'order' => 'ASC',
'posts_per_page' => '20',
'paged' => ( get_query_var('paged') ? get_query_var('paged') : 1 ),
)
);
foreach( $listingPages as $page ) {
$content = $page->post_content;
if ( ! $content ) // Check for empty page
continue;
$content = apply_filters( 'the_content', $content );
?>
<div class="attyrow">
<div class="attycol1">
<a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?></a>
</div>
<div class="attycol2">
<h2><a href="<?php echo get_page_link( $page->ID ); ?>"><?php echo $page->post_title; ?></a></h2>
</div>
<div class="attycol3">
<h3><?php $key="Location"; echo get_post_meta($page->ID, $key, true); ?></h3>
</div>
<div class="attycol4">
<h3><?php $key="Type"; echo get_post_meta($page->ID, $key, true); ?></h3>
</div>
<div class="attycol5">
<h4><?php echo get_the_term_list( $page->ID, 'areas', '', ', ', '' ); ?></h4>
</div>
</div>
<div style="clear:both"></div>
<hr>
<?php
}
?>
When I add 'meta_value' => 'Partner',
Then the page query comes back blank.
I’ve tried my way and the suggested way in the documentation with no luck. Any help?