How to get the get the select values created by ACF plugin in wordpress

In this bit of code: $field = get_field_object(‘field_51d3f9c3f5554’); $field[‘choices’] will contain an array of the available choices for that field, not the currently selected value, $field[‘value’] contains the currently selected value. However, using get_field_object when all you want is the currently selected value is unnecessary. for the correct use of get_field(), read the documentation carefully … Read more

Displaying an ACF list of users

You can use get_author_posts_url() or get_the_author_meta(): $values = get_field( ‘editor’ ); if ( $values ) { $editors = array(); foreach ( $values as $value ) { $link = get_author_posts_url( $value[‘ID’] ); //get the url $nicename = $value[‘user_nicename’]; $editors[] = sprintf( ‘<a href=”https://wordpress.stackexchange.com/questions/106854/%s”>%s</a>’, $link, $nicename ); //create a link for each author } echo ‘Edited by: … Read more

How to change the background color of my header dynamically based on a Custom Posts types color value?

Because my neighborhoods were the only pages that required custom header colors i decided to just include its custom header within the single-neighborhood.php page so that the top header container, that was wrapping the navigation, logo, etc., would reflect the custom color chosen from the custom fields in the admin. It was the only way … Read more