ACF loop and php formatting

If it can be explicetly defined as the_title, then this should work for you: $pages = get_pages(array (‘sort_column’ => ‘menu_order’)); foreach ($pages as $page_data) { $fields = get_fields($page_data); if( $fields ) { echo ‘<div class=”the_title”>’ .$fields[‘the_title’] . ‘</div>’; echo ‘<div class=”container”>’; foreach( $fields as $field_name => $value ) { $field = get_field_object($field_name, false, array(‘load_value’ => … Read more

Remove all paragraph tags

(obviously) untested, and make a backup of your DB first…but you ought to be able to do this natively in SQL: UPDATE wp_posts SET post_content = REPLACE(post_content, ‘<p>’, ”) WHERE (put whatever selection logic you want here…) Do the same for </p>. Like I said…make a backup first… (edit) geez, didn’t realize this was a … Read more

Reformat data within a nested array

A quick solution would be to change this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = $new_values[1]; unset( $new_values[1] ); } Into this: //rename the array keys foreach( $data as &$new_values ) { $new_values[‘user_id’] = (string) $new_values[0]; unset( $new_values[0] ); $new_values[‘product_id’] = (string) $new_values[1]; unset( … Read more