Skip Navigation

[Resolved] double image link displaying images in CPT

This thread is resolved. Here is a description of the problem and solution.

Problem:
when I tried to build image gallery for repeating image field using [wpv-for-each] shortcode, Double image links displaying

Solution:
Please make sure that you should not use separator attribute with your repeating image field shortcode when you put custom image shortcode within the [wpv-for-each] shortcode.

You can find proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/double-image-link-displaying-images-in-cpt/#post-655887

Relevant Documentation:
https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each

This support ticket is created 6 years, 9 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
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10: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/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by lorentoP 6 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#655735

I am trying to: display images stored in CPT in a row, in a CPT template

Link to a page where the issue can be seen: hidden link

I expected to see: images in a row that clicked open the full size image

Instead, I got: images in a column that clicked give an error because the link URL is dobled (URL URL)

I guess the row / column problem is due to how I display the CF, even if it is not clear when to use a content template and when a generic view. My understanding is that I should use a view to display a list / grid of data from multiple posts, a content template when I have to display meta from a single post. A better explanation of this would be appreciated. KIndest regards

#655887

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Could you please check now. I've modified your content template "Item gallery" as given under:

[wpv-for-each field="wpcf-item-photos"]
<div class="my_imgs"> 
<a href="{!{types field='item-photos' size='full' url='true'}!}{!{/types}!}">{!{types field='item-photos' alt='%%ALT%%' title='%%TITLE%%' size='thumbnail' align='center' resize='proportional'}!}{!{/types}!}</a>
</div>
[/wpv-for-each]

As you are using repeating fields - to display repeating field you can use [wpv-for-each] shortcode:

I also wrap the anchor and image with div that has class name "my_imgs" and I added following CSS

.my_imgs {
float: left;
padding: 15px;
}

However - You can adjust the styling as per your need and requirement.

More info:
=> https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-for-each

#656059

Thank you very very much for your superfast help.
It works and I will make my custom improvements if needed.
Can you please give me a clue about how content templates and views differ?
When to use content teplates and when to use views?
The question is silly for sure, I apologize but I am a bit confused, I am not experienced.
Kindest regards

Lorenzo

#656061

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Glad to know that it works for you.

Can you please give me a clue about how content templates and views differ? When to use content teplates and when to use views?
=> Yes sure. Please check our official Doc that explain this query:
https://toolset.com/faq/whats-the-difference-between-a-view-and-a-view-template/

#658574

Thank you very much, it is more clear and it confirmed my idea. Because I am using a builder, sometimes it is difficul to understand exactly what to choose.
Kindest regards