trying to get a wp query to only show the featured posts and limit them to 10, pretty sure I have done something wrong, it has been many years since I have had to to any kind of programming
trying to limit what is shown to only 10 items and only show the featured ones, using the ACF true/false field, we started with this:
function get_staff( ){
// Return the staff
return get_posts(array(
“posts_per_page” => 10,
“post_type” => “staff”,
“post_status” => “publish”,
));
which works, but now we want to have more staff entries but only show the 10 featured ones, so I added the field, marked some as being featured, and the rest as not, change the code to this
function get_staff( ){
// Return the staff
return get_posts(array(
“key” => “featured”,
“compare” => “=”,
“value” => “1”,
“posts_per_page” => 10,
“post_type” => “staff”,
“post_status” => “publish”,
));
and it is still showing the ones which were not marked as featured, how do I get this to work and only show the featured ones?
thanks