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

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

Changing a specific value inside a complex repeater/flexible content field (ACF)

Answering my own question again. 😛 I finally found this Gist that lets me get and set array variables via dot notation: https://gist.github.com/elfet/4713488 So I included the DotNotation class and now my code looks like this (skipping all sorts of error checking here) : $fieldmap_string = ‘key1.key2.key3.etc’; $current_page_content = get_field(‘page_content’, $source_post_id); $parsed_current_content = new DotNotation($current_page_content); … Read more

My get_terms not working for custom fields

The issue is with ACF as discussed here along with a solution: https://support.advancedcustomfields.com/forums/topic/how-to-use-wp-term-meta-on-acf-the-easy-way/ Courtesy of various posters there, the code I added to mu-plugins is: function acf_update_term_meta($value, $post_id, $field) { $object = get_queried_object(); $term_id = intval(filter_var($post_id, FILTER_SANITIZE_NUMBER_INT)); if (!isset($object->taxonomy) || !isset($object->term_id) || $term_id != $object->term_id) { // the current object is not a term return … Read more

Gutenberg on an ACF options page

Create a page named as your archive, add blocks there. In archive-name.php please add: <?php get_header(); $page_id = get_post( 57 ); $page = apply_filters( ‘the_content’, $page->post_content ); echo $page; ?> <?php get_footer(); Replace ’57’ with your page ID. Now you can manage content of archive page directly from Pages.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)