query posts based on carbon fields value
-
Hey There,
Thanks for your recent comment on my other ticket. I was reading the docs very late and definitely missed the relevant sections.
I have a new issue that I’m hoping to get your help with:
Trying to use a ‘meta-query’ argument in a ‘get_posts’ request.
For example:
<?php
$args = array (
'post_type' => array( 'document' ),
'post_status' => array( 'publish' ),
'meta_query' => array(
array(
'key' => '_doc_project_association',
'value' => $post->ID,
)
)
);
$docs = get_posts( $args );
foreach ($docs as $post) :
setup_postdata($post);
?>
<div class="mdl-list__item">
<span class="mdl-list__item-primary-content">
<i class="material-icons mdl-list__item-avatar ion-document-text"></i>
<span><?php the_title(); ?></span>
</span>
</div>
<?php
endforeach;
wp_reset_postdata();
?>
Is this the right key? How is the data returned?
Thanks for your help.
- The topic ‘query posts based on carbon fields value’ is closed to new replies.