Skip Navigation

[Résolu] Link to a Gallery thumbnail

This support ticket is created Il y a 5 années et 8 mois. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

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 3 réponses, has 2 voix.

Last updated by Beda Il y a 5 années et 8 mois.

Assisted by: Beda.

Auteur
Publications
#952456

Hi,

I need a link to a gallery.

I worked with thi code:

[wpv-for-each field="wpcf-accommodation-gallery"]
  <a class="thickbox" rel="gallery" href='[types field="accommodation-gallery" raw="true" link="false"][/types]'>[types field='accommodation-gallery' class="accommodation-gallery" title='%%TITLE%%' alt='%%ALT%%' align='left' size='custom' width='150' height='150' resize='proportional' separator=', '][/types]</a>
[/wpv-for-each]

It works with images displayed.

I need to use it just to create a button link "Show pictures" opening the thumbnail without the preview images.

How can I seti it?

#952779

The thick box is not intended to work like that.

As you see you need to have that HTML in a for each ShortCode, so it applies to EACH post in a Loop.
If you want a Button, that opens something (for example a View, that lists Pictures in a certain Gallery layout) then you can add that button anywhere you want.

If this is a repeating field Group and you want to open that specific Group with the Button - it's the same, just that you would add the Button HTML in the Loop and a PopUp or Modal linked to it, and within that Modal's HTML, a foreach code showing the single repeating fields images.

The thick box as you use it however is exactly made to have thumbnails (many) linked to (single) bigger images.

I think if I understand you right, you just want a button instead of single preview image, so just change the Title:
[php]
[wpv-for-each field="wpcf-accommodation-gallery"]
<a class="thickbox" rel="gallery" href='[types field="accommodation-gallery" raw="true" link="false"][/types]'>LINK TEXT</a>
[/wpv-for-each]
Buttons are HTML syntax:
hidden link

#952784

Hi Beda,

I tried with this

[wpv-for-each field="wpcf-accommodation-gallery"]
<button><a class="thickbox" rel="gallery" href='[types field="accommodation-gallery" raw="true" link="false"][/types]'>LINK TEXT 2</a></button>
[/wpv-for-each]

The result doesn't sounds good. In this way I have many button.

The result I aspected is one button to many images

#952809

Yes, this is what I outlined.

That Code, in the [wpv-for-each field="wpcf-accommodation-gallery"], applies to each instance of a Field.
The rest, in it, is simple HTML and will be repeated as many times there are fields.

So, if you want a button that does not repeat, but instead when you click, it opens those repeating fields in one place, then you need to put the Button's HTML in one place (where it cannot repeat, usually, OUTSIDE the loop)
After, INSIDE the loop (or if it's a repeating fields just for the field) you apply the foreach code.
That, must be wrapped in the container that you hide/show with the click on the button, exactly the same way as your current link/target works.

This is the basic HTML that you need, you can grab it from here:
hidden link
hidden link
Example is above, this below is for the Toolset details

OUTSIDE THE LOOP
Button (outside the loop or foreach) as in <em><u>hidden link</u></em>
<!-- Button trigger modal -->
<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
  Launch demo modal
</button>

INSIDE THE LOOP
If clicked open a previously hidden HTML container:
(anything, really, this is just an example, it requires any HTML container that you can hide/show)
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
  <div class="modal-dialog" role="document">
    <div class="modal-content">
      <div class="modal-header">
        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
        <h4 class="modal-title" id="myModalLabel">Modal title</h4>
      </div>
      <div class="modal-body">
        THIS IS WHERE YOU INSERT YOUR LOOP OR FOR EACH
        (this will show when you click the button, hence here you want either your view, displaying only images, or a Repeating field that is showing images in a certain grid layout)
      </div>
      <div class="modal-footer">
        <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
        <button type="button" class="btn btn-primary">Save changes</button>
      </div>
    </div>
  </div>
</div>

When you take the button out of either the loop or foreach (since you do not need it for each) it'll be solved.

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