OK, fixed it. Used this to output various details from file uploads:
<?php if( have_rows('files-ra') ): ?>
<?php while( have_rows('files-ra') ): the_row();
$file = get_sub_field('file');
$name = get_sub_field('file_name');
?>
<li>
<a href="<?php echo $file['url']; ?>"><?php the_sub_field('file_name'); ?></a>
</li>
<?php endwhile; ?>
</ul>
<?php endif; ?>
Thanks for the help
Hi Nuro. Thanks.
This isn’t working though. The output is just blank, and I definitely substituted your field names with mine:
<?php
$rows = get_field('files-ra');
if($rows) {
while(the_sub_field('files-ra')) {
$file = the_sub_field('file');
$name = the_sub_field('file_name');
echo '<li><a href="' . $file . '" title="' . $name . '">' . $name . '</a></li>' ;
}
}
?>
It might be worth noting that earlier in the document is
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
I need that still right?
Such confuse.
Thanks for this snippet – it did the job! Appreciated. Martin
Pirondini
Thanks for the help! Your time is much appreciated.
I’m still getting nothing returned in the src=”” field of the image.
I have the image field in question set up as a set up as a repeater field. It’s a child of the main group called ‘activity_slider’ with the image field called ‘photo’. So,
My code reads like this:
$attachment_id = get_sub_field('photo');
// the name of the sub field. Also tried without 'sub'.
$custom_thumb = wp_get_attachment_image_src( $attachment_id,"slide-thumb" );
// this is the name of the thumbnail size in functions.php
<img src="<?php echo $custom_feature[0]; ?>" />
Nothing is returned. Tried using $custom_thumb too, but no avail.
This is what you said to do right?
Thanks again. Martin.