I have a website that's making use of the FacetWP plugin and Advanced Custom Fields for making extra fields for the posts.
Each post can have a "Department" value and I need to make a foreach for the different departments like this:
if ($department == "Office") {
get all the post with the Value Office from the ACF field "department."
}
The custom field is a select/dropdown field.
I also need to do this same thing for other departments like "Production", "Boss", "Drinks". But I need to give the departments a title with the results below it.
What is the best way to do this?
Regards,
Update:
What I need to have in the end is this on one page in an overview:
Title: Office - Employee 1 - Employee 2 - Employee 3 - Employee 4
Title: Production - Employee 1 - Employee 2 - Employee 3
Title: Boss - Employee 1