I have
<?php $args = array(
'posts_per_page' => 5,
'offset' => 0,
'category' => '',
'orderby' => 'post_date',
'order' => 'DESC',
'include' => '',
'exclude' => '',
'meta_key' => '',
'meta_value' => '',
'post_type' => 'ait-dir-item',
'post_mime_type' => '',
'post_parent' => '',
'post_status' => 'publish',
'suppress_filters' => true );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) {
//print_r($post);
$key_1_value = get_post_meta($post->ID, '_ait-dir-item', true );
// check if the custom field has a value
if( ! empty( $key_1_value ) ) {
Print_r( $key_1_value);
}
}
Emphasized Text Here