Yikes! sorry about that code formatting mess. Not used to trying to post code here!
Hi, please provide an updated code sample (see WordPress’ documentation for instructions), and I would be glad to take a look.
SLB works with any valid link, regardless of whether the link contains text or an image.
However, from what I can see from the above snippet, it looks like you may be passing slb_activate() an image URL only. As per SLB’s manual activation documentation, it’s important to note that slb_activate() is used on content “containing links to be activated”, not bare URLs.
You can also use the example code included on that page for reference, as it demonstrates building an HTML link, and then passing the link through slb_activate() to activate it.
Ugh, you’re right. I was trying to activate an image url.
If feeling friendly, here’s my mess (snippet). Back to the drawing board!
<?php
if( have_rows('instructor') ):
while ( have_rows('instructor') ) : the_row();
$image = get_sub_field('biography_photo');
if ( function_exists('slb_activate') ) {
$image = slb_activate($image);
}
?>
<li>
<span class="bio-name"><?php the_sub_field('name'); ?></span>
<span class="bio-links">
<a href="<?php echo $image; ?>">Bio</a> |
<a href="<?php the_sub_field('bean_app_link'); ?>" target="_blank" rel="noopener noreferrer">Bean app</a>
</span>
</li>
<?php endwhile;
else :
// no rows found
endif;
?>
Thanks for reposting the code snippet. It looks like the “Display post thumbnail in lightbox” example code in SLB’s documentation is a good fit for your needs.
- The
$thumbnail['url'] variable contains the link’s URL, which you can replace with your ACF-based URL.
- The
$thumbnail['link'] variable is where the HTML link is built.
- Once the full link is built, you can
echo it into your HTML in place of the existing link with PHP-inserted URL.
Post your updated code snippet if you’re having any problems, and I would be glad to take a look.
Thank you for your help, I got it working. 🙂
Awesome, glad to hear it 🙂