Home › Forums › Front-end Issues › Displaying links or images & images as thumbnails + › Reply To: Displaying links or images & images as thumbnails +
Sorry Arcanepsyche, I tried to be as clear as possible.
You ask what is not working. Well . . . to answer that, the page just comes up with no content at all – just a blank page! so I guess I’ve made a mistake in the coding somewhere & I believe the problem is in the area marked // Start/End of section that doesn’t work – since if I remove that bit of code the page renders but without the link.
On the other point – interesting that you say I should be using get_sub_field instead of get_field – however, I have just replaced get_field with get_sub_field in the section of code not working (like you suggested) but it still just creates a blank page (see below for code) – As i said before my php coding is basic to say the least and would appreciate any help you can give. Many thanks Phil
<div class="radioBadges">
<?php
// using normal array
$rows = get_field('press_badge');
if($rows)
{
echo '<ul id="pressBadgesList" class="pressBadgesList">';
foreach($rows as $row)
{
echo '<li>' . '<div class=\'radio_badge_title\'><p>' . $row['press_title_printed'] . '</p></div>' ;
// Start of section that doesn't work
$links = get_sub_field('press_url');
if($links) {
echo '<' . 'a ' . 'target=' . '\'_blank\'' . 'href=' . $row['press_url'] . '>'
}
else
{echo '<' . 'a ' . 'rel=\'lightbox[reviews]\'' . 'href=' . $row['press_image_printed'] . '>' };
// End of section that doesn't work
echo ('<' . 'img src=' . $row['press_image_printed'] . ' width=\'150\'' . 'height=\'150\'' . '>' .'</a>'.'</li>');
}
echo '</ul>';
}
?>
</div>
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.