Skip Navigation

[Resolved] Adding terms field to the loop editor

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

Problem:
Adding terms field to the loop editor for the last instance

Solution:
you can use the [wpv-item index=pad-last] to add whatever content you want to add for last row the last column:

You can find the proposed solution, in this case, with the following reply:
=> https://toolset.com/forums/topic/adding-terms-field-to-the-loop-editor/#post-1196451

Relevant Documentation:
https://toolset.com/documentation/user-guides/digging-into-view-outputs/#wpv-item-indexpad-last

This support ticket is created 5 years, 10 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 10 replies, has 2 voices.

Last updated by johnh-18 5 years, 10 months ago.

Assisted by: Minesh.

Author
Posts
#1193433
algarve.jpg

Not sure how to explain this in a simple way but with the attached image, I hope the following makes sense.
The site is a real estate site and in the property page template I have a Toolset view that shows in a 4x2 grid the last 7 properties added to the site in the same destination as the property featured on the property page.
What I want to do is to add a terms field, eg [types termmeta='destinations-image' title='%%TITLE%%' alt='%%ALT%%' size='full'][/types], to the view loop editor so that the last slot in the grid always show the destinations image for the same destination that the previous images are related to.
The problem is that I do not know where in the loop editor to enter the short code.
The loop editor code is as follows
[wpv-layout-start]
[wpv-items-found]
<!-- wpv-loop-start -->
<wpv-loop wrap="4" pad="true">
[wpv-item index=1]
<div class="row ">
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-most-recent-properties-view-test"]</div>
[wpv-item index=other]
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-most-recent-properties-view-test"]</div>
[wpv-item index=4]
<div class="col-sm-3">[wpv-post-body view_template="loop-item-in-most-recent-properties-view-test"]</div>
</div>
[wpv-item index=pad]
<div class="col-sm-3"></div>
[wpv-item index=pad-last]
<div class="col-sm-3"></div>
</div>
</wpv-loop>
<!-- wpv-loop-end -->
[/wpv-items-found]
[wpv-no-items-found]
[wpml-string context="wpv-views"]No items found[/wpml-string]
[/wpv-no-items-found]
[wpv-layout-end]

'Destination' is a taxonomy linked to a custom post type.
I have attached an image visualising what I want to achieve and you can view the site at hidden link (scroll down to the bottom of the page)
The site is password protected - login details are
user: tga
pw: Krit@45
Best regards / john

#1193496

Minesh
Supporter

Languages: English (English )

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

Hello. Thank you for contacting the Toolset support.

Well - At the moment, you can display term fields on a View listing terms and on a term archive page.

To display the custom term field, what you should do it create a taxonomy view and within that taxonomy, view add the term field you want to display and add this view inside your post view where you want to display the term field.

Please check the following Doc:
=> https://toolset.com/documentation/user-guides/displaying-wordpress-term-fields/

#1196067
algarve.jpg

Hi Minesh,
Thank you for your response. The problem is slightly different. I know how to display term fields - but what I do not know is how to integrate the term field with the other details in the loop editor view, ie how to display the term field (image) in the empty 8th slot in the 4x2 grid as per the image (attaching that again for clarity). Also, the image should be linked so when clicking on the terms field image in the 8th slot, it will take you to the relevant archive page.
Best regards/john

#1196451

Minesh
Supporter

Languages: English (English )

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

With the code you shared - you will see the following. you can use the pad-last to add whatever content you want to add for last row last column:

[wpv-item index=pad-last]
<div class="col-sm-3"></div>

Please check the following Doc for better understanding about pad-last :
=> https://toolset.com/documentation/user-guides/digging-into-view-outputs/#wpv-item-indexpad-last

#1196634

Hi Minesh,
Thank you for your message. Following your advice, I can display the taxonomy term field (image) - but not at the same time as the post types images.
I guess the problem may be that the system only allows me to display EITHER taxonomy fields OR post type fields - but not both in the same view. Is that assumption correct or is there a way around this?
Best regards/john

#1196726

Minesh
Supporter

Languages: English (English )

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

What you should do is create a taxonomy view and filter it by your taxonomy term and add whatever term custom fields you want to display to it and then, later on, add this newly created taxonomy view just after the pad-last statement.

#1197139
order.jpg

Hi Minesh,
Thanks - works perfect. A final question with regards to this ticket.
The grid is 4x2, ie there are 8 slots. In cases where there are not fewer than eight posts to display in the grid, is there a way to make the 'last image' appear next to the last post? I tried [wpv-item index=pad] which kind of does the trick - the problem here is that the image is repeated so it fills all empty slots instead of just the first empty slot. I have attached an image for illustration purposes.
Best regards / john

#1197189

Minesh
Supporter

Languages: English (English )

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

Well - following are the possible values for the index you can use with [wpv-item] shortcode:
=> https://toolset.com/documentation/user-guides/digging-into-view-outputs/#loop-shortcode-wpv-item-and-the-index-parameter

There is no such feature exists and as you use pad, the output you are getting is expected.

#1197223
archive.jpg
property.jpg

Hi Minesh,
Thanks, will stick to pad-last.
However, I just noted that this solution brings another issue and I am not sure if this is a problem for you or for Elementor (the theme). The problem is that this code is affecting the width of some of the columns in the footer - I have attached two images, the property page where 'pad-last' is part of the template and an archive page where 'pad last' is not used.
You can also view the live pages on the following links (the site is password protected; user:tga, pw: Krit@45 )
hidden link
hidden link
Best regards / john

#1197232

Minesh
Supporter

Languages: English (English )

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

Well - would you mind to create a another ticket with your every new question/issue/problem you may have.

I'm about to close my shift here. or you can create a ticket and assign it to me, I will take a look this tomorrow. Feel free to close this ticket.

#1197243

My issue is resolved now. Thank you!