How do I replace the post title with a custom field?

The acf/update_value filter won’t work as it’s meant for modifying the acf value and not the post it’s associated with. Try using the acf/save_post action instead. Here’s a simplified example of how I’d normally set the post title from first and last name fields in acf. add_action( ‘acf/save_post’, ‘biwp_set_title_from_first_last_name’, 20 ); function biwp_set_title_from_first_last_name( $post_id ) … Read more

get value from selected input

Well, I don’t know how many input type of radios and checkboxes you have, but this should get you want you need: $(document).ready(function() { $(‘input:radio’).change(function() { // get the value var newValue = $(this).val(); // Update the div.score $(‘div.score’).text(newValue); }); }); PS: Your radio input need to have the same name, if you do not … Read more

How do I get_the_postID() for a custom post that uses ACF repeater field?

From the plugin code I can see that it uses query_posts() to set up a new context for your template if you’re using display=”blah.php”. So you should just need to add the loop around your template: <?php /** * Template Name: Gallery */ while ( have_posts() ): the_post(); // <– Important bit if( have_rows( ‘card’ … Read more

Refactoring long if/else php chains

There is no hard limit, but when you have many fields (I’m talking hundreds or thousands, not dozens), you might run into limits on execution time on your host. In this case, I’d do something like this to turn it into a loop if you don’t need specific HTML. foreach(range(1, 5, 1) as $imageNumber) { … Read more