Skip Navigation

[Resolved] Lightbox plugins not working with usermeta image field

This support ticket is created 6 years, 4 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 6 replies, has 2 voices.

Last updated by Luo Yang 6 years, 3 months ago.

Assisted by: Luo Yang.

Author
Posts
#598232

I do make sure that the user-meta image field is not working with lightbox plugin, today I have tested with some popular lightbox plugins, like, lightbox-2 easy fancy lightbox, responsive lightbox ect, whichever I use, all plugins are not working with usermeta, neither singular fields or repeating usermeta image fields. but all plugins are working fine with type fields. I guess something wrong with usermeta. could you please debug failures? Thank you so much!

#598242
QQ图片20171212170015.png
QQ图片20171212165847.png

I uploaded some screenshots for reference

#598308

Dear Jeffrey,

Since it is a compatibility problem, please provide detail steps to duplicate same problem:
How do yo setup the custom user image field?
How do you lightbox with Types shortcoded?
If it needs other plugin, please provide the downloadable URL for it, I need to test and debug it in my localhost, thanks

#599452

Hi Luo, to verify what is going on is not very difficult. I launched a new site. only toolset plugins and set up a view and a layout, I used 3 kind of plugins to set up a lightbox, single image and repeating type field working fine. but usermeta is not working. these plugins include Easy fancybox, responsive lightbox and lightbox 2. in order to make the plugins working fine. I also add

 rel="lightbox[roadtrip]">

to usermeta shortcode. but whatever I do or not. it was still not working. you don't need to duplicate my live site, just set up a repeating image field to toolset child and then active whatever plugins you want, you will see that once more. I guess that is a small bug? could you please check it again for me? Thank you so much!

#599690

Where is the shortcode [roadtrip] from? is it from other plugins?
Since you did not provide the detail steps, I can not duplicate same problem, please provide a duplicator package of your website in below private detail box, also point out the problem page URL, and where should I check, I need to test and debug it in my localhost, thanks:
https://toolset.com/faq/provide-supporters-copy-site/

#601358

Sorry for replying you late. it seems something I set wrong. I just show you here what I set it up, and please help me check what I did wrong if possible. Thanks!

<a href="[types usermeta='house-images' size='full' url='true' user_is_author='true' separator=', ' index='0'][/types]">[types usermeta='house-images' alt='%%ALT%%' class="img-fluid" alt="Responsive image" index='0' title='%%TITLE%%' size='medium_large'  align='none' resize='stretch' user_is_author='true' style='width:100%; height:350px; object-fit: cover; overflow: hidden' separator=', '][/types]</a>/********this section using for displaying the first image of repeating image field******/
[wpv-for-each usermeta="wpcf-house-images"]<a href="[types usermeta='house-images' size='full' url='true' user_is_author='true' separator=', '][/types]">[types usermeta='house-images' alt='%%ALT%%' title='%%TITLE%%' size='thumbnail'  align='none' resize='crop' user_is_author='true' separator=''][/types]</a>[/wpv-for-each] /***********this section using for displaying entire repeathing image field**********************/

but whatever I was using [wpv-for-each] or not, the pics of second section went to 404 page, and got url on browser like
hidden link I guess the repeating image field which was not output correctly one by one. Thank you so much! and Happy holiday!

#601386

According to our document:
https://toolset.com/documentation/views-shortcodes/#wpv-for-each
wpv-for-each
description:
Iterate through multiple items in a post meta field and output the enclosed text for each item. Including Types repeating fields.

It only works in custom post fields, it does not work for custom user fields.

In your case you can try to create a custom shortcode for it, for example:
1) Add below codes into your theme/functions.php:

add_shortcode( 'repeating_user_images', 'repeating_user_images_func');
function repeating_user_images_func($atts)
{
    $attributes = shortcode_atts( array(
        'image_slug' => '',
    ), $atts );
    extract( $attributes);
	
    $small_images_urls = do_shortcode("[types usermeta='" . $image_slug . "' alt='%%ALT%%' title='%%TITLE%%' size='thumbnail' align='none' user_is_author='true' separator='|'][/types]");
	$small_images_urls_arr = explode('|', $small_images_urls);
	
    $big_images_urls = do_shortcode("[types usermeta='" . $image_slug . "' size='full' url='true' user_is_author='true' separator='|'][/types]");
	$big_images_urls_arr = explode('|', $big_images_urls);
    $all_images = '';
 
    foreach($small_images_urls_arr as $k => $v){
		$all_images .= '<a href="' . $big_images_urls_arr[$k] . '">'. $v . '</a>'; // here customize the image links with HTML codes
    } 
    return $all_images;
}

2) use above shortcode in your content, like this:
[repeating_user_images image_slug='house-images']

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.