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?
Thanks for your hard work!
Does all this code go into the page template? I attempted to get it to work by putting it there and editing the latter part appropriately but now the page doesn’t show anything. I made the code into this:
<?php get_header(); ?>
<section class="content">
<?php get_template_part('inc/page-title'); ?>
<div class="pad group">
<div class="entry">
<div class="entry-inner">
<?php the_content(); ?>
<?php wp_link_pages(array('before'=>'<div class="post-pages">'.__('Pages:','hueman'),'after'=>'</div>')); ?>
</div>
<div class="clear"></div>
</div><!--/.entry-->
<?php
$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);
}
}
foreach( $temporary_list as $i => $row ) {
$order[ $i ] = $row['film_name'];
}
array_multisort( $order, SORT_ASC, $temporary_list );
if($posts)
{
echo '<ul>';
foreach($posts as $post)
{
echo '<li><a href="' . get_permalink($post->ID) . '">' . get_field($temporary_list, $post->ID) . '</a></li>';
}
echo '</ul>';
}
?>
</div><!--/.pad-->
</section><!--/.content-->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
Where did I go wrong?
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.