Skip Navigation

[Resolved] making links out of repeater field image

The Toolset Community Forum is closed, for technical support questions, please head on to our Toolset Professional Support (for paid clients), with any pre-sale or admin question please contact us here.
This support ticket is created 8 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
This is the community support forum for Types plugin, which is part of Toolset. Toolset is a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients and people who registered for Types community support can post in it.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 5 replies, has 2 voices.

Last updated by brianO 8 years, 9 months ago.

Assisted by: Beda.

Author
Posts
#321500

I am trying to:
I have a custom image field that allows multiple images. In the content type that uses field group, I would like to better control each image with a light box link.
Based on: https://toolset.com/documentation/user-guides/repeating-fields/#Displaying

<div class="projectImages">
  <ul>
[wpv-for-each field="wpcf-project-images"]
  <li><a rel="lightbox" href="[types field="project-images" size="large" url="true" resize="proportional"][/types]">
  [types field="project-images" size="medium" align="none" resize="proportional"][/types]
    </a>
  </li>
[/wpv-for-each]
</ul>

I visited this URL:

I expected to see:

A list of images each linking to there respective lightbox original image.

Instead, I got:
List of images, with broken "a" tags


<ul>
<li>
 <a rel="lightbox" href="[types field=" project-images"="" output=""raw"][/types]""> 

<img alt="/wpg/wp-content/uploads/2015/07/slide1-wpcf_300x145.png" title="<em><u>hidden link</u></em>" class="attachment-medium" src="/wpg/wp-content/uploads/2015/07/slide1-wpcf_300x145.png?1a919b"> 

</a>
</li>
</ul>

#321522

Thank you for contacting us here in the Support Forum

Currently you could experience this issue due to the issue with WordPress API Update 4.2.3
https://toolset.com/2015/07/wordpress-4-2-3-fixes-a-security-problem-but-breaks-sites-with-shortcodes/

To see if that is the cause, please follow this instructions:
★ INSTRUCTIONS:

❌ Backup your website and database ❌
• Deactivate/Delete the "Installer" plugin (if you have it)
• Deactivate Views and Types plugins
• Login via FTP to your wp-content/plugins folder
• Delete Views and Types Plugins folders
• Go to https://toolset.com/account/downloads/ and download the latest beta Views and Types Plugin, then extract it.
• Upload the plugin via FTP to the wp-content/plugins folder.
⌥ alternatively you could upload the .zip file using Dashboard > Plugins > New > Upload
• Activate them in Dashboard > Plugins
This should not generate any problems.

If the issue doesn't solve with the above approach, I can suggest a similar approach with ThickBox, which is the inbuilt WordPress "Lightbox"
https://toolset.com/forums/topic/lightbox-effect/
https://toolset.com/forums/topic/image-slider-within-a-post/#post-272455

As example, you can then use:

[wpv-for-each field="wpcf-image"]
<a class="thickbox" rel="gallery" href="[types field="image" raw="true"][/types]">[types field="image" size="your_size"][/types]</a>
[/wpv-for-each]

You will need to first enable ThickBox in the Theme's functions.php

add_action( 'wp_enqueue_scripts', 'add_thickbox' );

Your approach also should work, using this:

<div class="projectImages">
  <ul>
[wpv-for-each field="wpcf-project-images"]
  <li><a rel="lightbox" href="[types field="project-images" raw="true"][/types]">
  [types field="project-images" size="medium" align="none" resize="proportional"][/types]
    </a>
  </li>
[/wpv-for-each]
</ul>
</div>

Please don't hesitate to inform me in case the issue persists

Thank you

#321526

Hi Beda,
Thank you for the response. I will work on this tonight and let you know.

Brian

#321532

Thanks for the Details

Please don't hesitate in case the issue persist, to request my feedback

Please acknowledge my Working Hours, you can see them in my profile:
https://toolset.com/forums/users/beda-s/

I'm off until Sunday, but Shane and also I will keep an eye on the queue here, so if you have urgent queries somebody will get back at you.

Thank you for your patience.

#321839

Hi,

Sorry still getting the same outcome with thickbox (no update beta):

<a class="thickbox" rel="gallery" href="[types field=" project-images"="" size="large" url="true" resize="proportional" ][="" types]"="">
  <img alt="<em><u>hidden link</u></em>" title="<em><u>hidden link</u></em>" class="attachment-medium" src="//www.jvmconstruct.com/wpg/wp-content/uploads/2015/07/house1-about-wpcf_300x222.png">
    </a>

Should I be escaping the " \"

<div class="projectImages">
[wpv-for-each field="wpcf-project-images"]
 <a class="thickbox" rel="gallery" href="[types field="project-images" size="large" url="true" resize="proportional"][/types]">
  [types field="project-images" size="medium" align="none" resize="proportional"][/types]
    </a>
[/wpv-for-each]
</div>

I made a copy of the site and updated to the beta version of tool/views.
Thickbox is not working. But the lightbox kinda works, but has issues. It is giving larger images rather than medium, and linking to the same size it is showing.

[wpv-for-each field="wpcf-project-images"]
<div class="projectImages">
      <a rel="lightbox" href="[types field="project-images" size="large" url="true" resize="stretch"][/types]">
        
        [types field="project-images" size="thumbnail" align="center" resize="stretch"][/types]
    </a>
  
</div>
[/wpv-for-each]
<a rel="lightbox" href="<em><u>hidden link</u></em>">
        
        <img alt="<em><u>hidden link</u></em>" title="<em><u>hidden link</u></em>" class="attachment-thumbnail aligncenter" src="<em><u>hidden link</u></em>">
    </a>
#321842

I created a new content and deleted the old, and now it works. The beta was the trick for me.

Thank you.

Brian

The forum ‘Types Community Support’ is closed to new topics and replies.

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