Tag Info

Hot answers tagged

2

the_field() is an ACF function and will echo content. It follows the WordPress (somewhat) pattern whereby functions with the_ at the front will echo content and functions beginning with get_ return content. Displays the value of the specified field. (this is the same as “echo get_field($field_name)”) ...


2

I managed to get this working using nothing but WordPress filters, thanks to @Milo's hint. Just note that these are pretty specific to my case but you shouldn't have a problem modifying them for your own use. I am using Advanced Custom Fields with a Date Picker field called date and Prev/Next links only point to events with date fields set to any day before ...


1

Throwing the solution here for better reading. $field = get_field_object('field_name'); $value = get_field('field_name'); $label = $field['choices'][ $value ]; The value in $label will be the label related to the value set in $value.


1

The query will by default GROUP BY the post ID, meaning that a post will only appear once in the list. You can remove that GROUP BY pretty easily with a filter: add_filter('posts_groupby','__return_empty_string'); $events = new WP_Query($args); remove_filter('posts_groupby','__return_empty_string'); That might get you what you want. It is a bit hard to ...


1

Use WP_Query instead, and you can use the meta_key / meta_value parameters: <?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1; $args = array( 'cat' => 10, 'paged' => $paged, 'posts_per_page' => 12, 'post_status' => 'any', 'order' => 'ASC', 'meta_key' => 'archived', 'meta_value' => 'true' ); ...



Only top voted, non community-wiki answers of a minimum length are eligible