I've got this following block of code and want to limit the number posts to 2, but it doesn't seem to work..?? I've also tried using posts_per_page, doesn't seem to work either.
Can anyone help point out where I'm going wrong?
<?php
$tax_country = strip_tags( get_the_term_list($post->ID, 'country') );
echo '<h1>More Properties in ';
echo $tax_country;
echo '...</h1>';
$relates = get_posts(array(
'post_type' => 'propertyawardwinners',
'numberposts' => -1,
'tax_query' => array(
array(
'taxonomy' => 'country',
'field' => 'slug',
'terms' => array($tax_country),
'include_children' => false
)
)
));
foreach ($relates as $relate) {
echo $relate->post_title . '<br/>';
echo $relate->ID . '<br/>';
echo get_field('location_city') . '<br/><br/>';
}
?>