update_field() with repeater fields issue [closed]
Solved!!! $post_id = $pid; needs to be $post_id = “user_{$pid}”; Seems pretty obvious now as the id could be for anything. Chris
Solved!!! $post_id = $pid; needs to be $post_id = “user_{$pid}”; Seems pretty obvious now as the id could be for anything. Chris
What “return format” do you have set in ACF for the date field? Sorting by numbers produces unexpected results when you use “d/m/Y” or “m/d/Y”. If you instead choose “Ymd” as in “20180221” for the return format, you’ll get an integer that’s sortable in the expected way.
Nevermind, got it – it’s simply {{ group }} when calling the value! {% for contact in mc.contacts %} {% for group in contact.groups %} {{ group }} {% endfor %} {% endfor %}
You can use the global $wp_locale to get the month translated in each language. You just need to get the month number (01 to 12) from the Acf field. You have the functions in the WP_Locale class get_month() and get_month_abbrev() global $wp_locale; $month = $wp_locale->get_month(04); // Output april in english $month_abbrev = $wp_locale->get_month_abbrev($month); // Output … Read more
You’re missing quotes around the content of innerHTML. If correctoutput is <div></div>, then you’re script looks like this: $(‘#correcto’).innerHTML(<div></div>); Which is invalid, because you’re missing quotes. innerHTML needs a string, which is in quotes in JavaScript. That first < is where your error is coming from. So you need to do this: $(‘#correcto’).innerHTML(‘<?php the_field(‘correctoutput’); ?>’); … Read more
Just make the field type as text and it will work
WordPress content is “frozen”. That is, if you add an alt on an image after posting an article with the image, the alt attribute will not be updated on its own. If you ever use Gutenberg, it is easy to be able to make a regex and update your article on the fly. You can … Read more
Less code lines with get_post_custom_values() $values = get_post_custom_values(‘slider_id’, $post_id); // if non-empty if($values) { foreach($values as $value) echo get_new_royalslider($value); } If $values array is empty, nothing happens.
Rather than outputting all rows, you can check each row in a loop and only output it if something matches. In this example, there’s a treatment field within the repeater that is the value of the name of the treatment post. If the two match, output the other values: $other_page = 89; $practioners = get_field( … Read more
“Advanced custom field plugin not showing in admin sidebar” gave me a useful clue. Finally, I’ve moved int the plugin directory, and cloned the git repo directly: git clone git://github.com/elliotcondon/acf4.git advanced-custom-fields