How to Filter Posts by Custom Fields?

Since you have not provided any code, below code snippet assumes a ‘property’ as post type and price as meta field. I think the code will provide you some direction and you can take it from there. Feel free to make changes as needed: $args = array(‘post_type’ => ‘property’, ‘meta_key’ => ‘price’, ‘orderby’ => ‘meta_value’, … Read more

Rewrite and custom post type: order by custom field not working

If your post type slug is placement, and you set has_archive to true, then the archive WordPress generates is at /placement/. Set has_archive to placements instead and let WordPress add the rewrite rules (which will also handle pagination properly). Then, to order by your meta key, add a function hooked to pre_get_posts, check if the … Read more

Retrieve value of a category’s custom field

http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/ prety much covers what you’re after I believe. So in your example while ( $projects->have_posts() ) { $projects->the_post(); $category_classes = array(); $categories = get_the_terms( get_the_ID(), ‘project_category’ ); if ( $categories ) { foreach ( $categories as $category ) { $categories_included[] = $category->term_id; $color = get_field(‘color’, ‘project_category_’.$category->term_id); } } You can also pass a term … Read more