Home › Toolset Professional Support › [Resolved] Hide on last record using template for view
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 |
---|---|---|---|---|---|---|
- | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | 7:00 – 14:00 | - |
- | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | 15:00 – 16:00 | - |
Supporter timezone: Europe/London (GMT+00:00)
Tagged: Plugin Views, Views
This topic contains 1 reply, has 2 voices.
Last updated by Nigel 5 years, 2 months ago.
Assisted by: Nigel.
I am trying to: Hide the <hr> tag when the last record is reached.
Link to a page where the issue can be seen: hidden link Look in the Helpful Docs right sidebar for an example of the <hr> tag displaying after the last record.
Here is the html code in the template section of the edit view screen.
<div class="custom-cta">
<h5>[wpv-post-title output="sanitize"]</h5>
[types field='document-description'][/types]
<p>Click to Download</p>
<hr>
</div>
Languages: English (English ) Spanish (Español )
Timezone: Europe/London (GMT+00:00)
Hi Rene
When you use the Loop Wizard the markup generated for the loop output typically includes the wpv-item shortcode used to generate different output for different positions in the loop, but your case isn't specifically covered.
It is documented here: https://toolset.com/documentation/user-guides/views-shortcodes/#wpv-item
I've just noticed that the item=last attribute isn't listed, so let me forward that to the documentation team.
In any case, here is an example of the kind of thing you need:
<wpv-loop> [wpv-item index=other] <div class="not-last"> <h3>[wpv-post-link]</h3> <hr> </div> [wpv-item index=last] <div class="last"> <h3>[wpv-post-link]</h3> </div> </wpv-loop>
It shows how one thing is being output for the last item in the loop (with no hr tag) while another is being output for all others (with an hr tag).