The below code is working fine.
<?php
$args = array(
'post_type' => 'myposttype',
'tax_query' => array(
array(
'taxonomy' => 'custom taxonoy name',
'field' => 'slug',
'terms' => 'custom taxonoy value',
'include_children' => false
)
)
);
$posts= get_posts( $args );
if ($posts) {
foreach ( $posts as $post ) {
setup_postdata($post);
/*print_r($countrypost);
echo $countrypost->post_title;*/
?>
<div class="post_li">
<h3><?php echo $countrypost->post_title; ?></h3>
</div>
}
}
?>
]]>
When posting code, please wrap in in backticks (using the code button on the toolbar) so it’s readable.
Also, please do not sign your replies with a link to your site.
Thanks.
]]>