Add custom Field after content
-
Hello everyone,
I have this code in function.php:
https://gist.github.com/anonymous/3d8e3f3d878ca10dfdd2
I would like to add a new field that should be displayed after the content.
After the last line of code I have added this function:add_action('__after_content','my_acf',100); function my_acf() { if ( ! is_single() ) return; <?php $posts = get_field('fumetti'); if( $posts ): ?> <div class="box-tipo"><div class="box-campo">Relazione Fumetti:</div><div class="box-risultato"><ul class="box-voci"> <?php foreach( $posts as $p ): // variable must NOT be called $post (IMPORTANT) ?> <li><a href="<?php echo get_permalink( $p->ID ); ?>"><?php echo get_the_title( $p->ID ); ?></a></li> <?php endforeach; ?></ul></div></div> <?php endif; ?> }Unfortunately it seems not to work. Where did I go wrong?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
The topic ‘Add custom Field after content’ is closed to new replies.
