Home › Forums › Backend Issues (wp-admin) › Can I use the text area to generate multiple meta values? › Reply To: Can I use the text area to generate multiple meta values?
Hi @vierastalo
For something like this, you need to split the entries and then save it to a temporary variable like this:
$temporary_list = array();
foreach($posts as $post){
$film_names = get_field('elokuvat_k', $post->ID);
$film_names_array = preg_split( '/\r\n|\r|\n/', $string );
foreach($film_names_array as $film_name){
$temporary_list[] = array('post_id' => $post->ID, 'film_name' => $film_name);
}
}
After that you need to sort the array using array_multisort() function like sorting a repeater.
foreach( $temporary_list as $i => $row ) {
$order[ $i ] = $row['film_name'];
}
array_multisort( $order, SORT_ASC, $temporary_list );
Then you can loop the $temporary_list
variable to show the entries.
I hope this makes sense.
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.