Tagged: acf
-
AuthorPosts
-
July 15, 2017 at 2:04 pm #821671
Hi there,
I used Advanced Custom Fields Pro to make a new input field called ‘gravitygallerij’.
I want it to show up on every new post I make on my Enfold site.
I have the code below to do that but I have no idea where to put it.
I tried pasting it in single.php but that didn’t do the trick.Can you please tell me which file to edit?
Hope you can help me – with kind regards!
<?php $images = get_field('gallery'); if( $images ): ?> <ul> <?php foreach( $images as $image ): ?> <li> <a href="<?php echo $image['url']; ?>"> <img src="<?php echo $image['sizes']['thumbnail']; ?>" alt="<?php echo $image['alt']; ?>" /> </a> <p><?php echo $image['caption']; ?></p> </li> <?php endforeach; ?> </ul> <?php endif; ?>
July 16, 2017 at 10:46 pm #822200Hey MulderMind,
Unfortunately it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However if its really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
BasilisJuly 17, 2017 at 7:20 pm #822838Hi Basilis,
Thanks for the reply – it was really important for me to get it done.
Luckely the guys over at AFC helped me out (really awesome) and it works now.
They gave me code to add to single.php and the images I add to the custom field of my posts show up underneath the posts now.
In case everyone else has the same wish, you can use the code James from ACF gave me below.With kind regards!
`<?php
//get the global post to access the post id
global $post;
$images = get_field(‘NAMEOFYOURGALLERYFIELD, $post->ID);if( $images ): ?>
-
<?php foreach( $images as $image ): ?>
-
“>
” alt=”<?php echo $image[‘alt’]; ?>” />
<p><?php echo $image[‘caption’]; ?></p>
<?php endforeach; ?>
<?php endif; ?>
July 19, 2017 at 4:19 am #823615Hi,
Great, glad you got help form ACF and thanks for sharing, much appreciated :-)
Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardJuly 31, 2017 at 1:03 pm #832097Hi Rikard,
You can close it – thanks for your assistance
-
“>
-
AuthorPosts
- The topic ‘Show AFC Gallery field in every new post’ is closed to new replies.