ACF: replace comma with another sign [closed]

Modify the following line in your function: $value = number_format(floatval($value), 2); To include another two arguments from the number_format() function – namely the decimal separator (set to a dot) and the thousands separator (set to an apostrophe) $value = number_format(floatval($value), 2, “.”, “‘”); So in total this line says: format the number (after floating it … Read more

Pull out Advanced Custom Fields in Related post plugin

According to advenced custom fields you get the value with get_field http://www.advancedcustomfields.com/docs/functions/get_field/ Just change “text_field” to your field-key. <?php $related = MRP_get_related_posts( $post->ID, true, false, ‘quote_list’ ); if( !empty( $related ) ) { foreach( $related as $key => $value ) { // Get post $related = get_post( $value ); // Get the field “text_field” on … Read more

How to share repeated fields across multiple pages?

The ACF functions accept a second argument which is the ID of the page you wish to retrieve the fields from. See the code examples in documentation. $page_id = 120; if( get_field( ‘treatments’, $page_id ) ): while( has_sub_field( ‘treatments’, $page_id ) ): // the_sub_field and get_sub_field don’t need a post id parameter the_sub_field(‘image’ ); the_sub_field(‘description’ … Read more

How do I run through a WordPress loop called from a filter function?

When using a custom query, in order to access the $post information, you need to reference post as a class variable the custom WP_Query. Since you constructed the query as: $hw_selectbox_query = new WP_Query($hw_selectbox_args); Then you would access the post variable of $hw_selectbox_query, like so: var_dump($hw_selectbox_query->post); This will give you the information you need / … Read more

Can I wrap an unordered list inside a shortcode?

You can capture the list in a variable, rather than echo it: $list=”<ul class=”strong”> <li>” . get_field( ‘highlights_list_item#1’ ) . ‘</li> <li>’ . get_field( ‘highlights_list_item#2’ ) . ‘</li> </ul>’; echo do_shortcode( ‘[one_half]’ . $list . ‘[/one_half]’ ); Note the use of get_field() rather than the_field(), which returns a custom field value as opposed to displaying … Read more