Hi, as noted in the thread you’re referring to, manually adding SLB-specific attributes is not recommended as they are intended for internal use only and thus can change at any time.
You can use slb_activate() to activate valid links that are not inside of a post/page. Here is more information on using slb_activate().
Here is a more recent thread with information on using slb_activate() with the post thumbnail. The code would replace the current code in the theme used to display the featured image.
<!– ADD LARGE FEATURED IMAGE & LINK TO FULL IMAGE –>
<?php
if ( has_post_thumbnail() ) {
$full_image_url = wp_get_attachment_image_src( get_post_thumbnail_id(), ‘full’ );
$content = ‘‘ . get_the_post_thumbnail( $post_id, ‘large’ ) . ‘‘;
if ( function_exists(‘slb_activate’) ) {
$content = slb_activate($content);
echo $content;
}
}
?>`
Ok, so the above should be the code to use slb_activate to enable featured image pop-up. May I know where should I insert the above code?
Thanks,
Hi, yep that code should work fine. For some reason, the link to the previous thread disappeared from my last reply, so I’m glad you were able to locate it.
For future reference, here is the other thread: https://wordpress.org/support/topic/help-activating-slb-in-my-theme
Also, as previously mentioned, the SLB-activated code would replace the theme’s code used to display the post thumbnail. This can differ from theme to theme, so I would recommend contacting your theme’s developer for specific instructions on where modifications would need to be made.
I have checked with theme developer, I should be able to add the mentioned code to functions.php.
I add the above code to the end of functions.php but somehow it doesn’t work.
I could have done something wrong, any advice from your side?
Many thanks.
The theme’s developer would likely know best, but simply adding the aforementioned code to the theme’s functions.php file is unlikely to do anything.
As previously mentioned, in most themes, you’ll want to replace the instances where the standard post thumbnail is displayed. This is usually done using the the_post_thumbnail() (documentation).
Yes, the theme developer at http://foxland.fi has helped me to work out the script.
The script works in the Eemeli pro child theme.
You can take a look at my site here http://SnapEscape.com.