Skip Navigation

[Resolved] How to show a list’s most recent post date

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

Problem: I have a table View that shows a list of posts. I'd like to include a date in the table header that indicates the most recent post date.

Solution: Create a View that shows the same results, but use post date descending order and set the limit to 1 result. In the Loop output, insert a post date shortcode. Place this View inside the table header of the existing View. Check "disable wrapping div around this view" to display the text inline.

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
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 6 replies, has 2 voices.

Last updated by CommMgr 5 years, 10 months ago.

Assisted by: Christian Cox.

Author
Posts
#1189823
LSW_exhibitor_list_date_updating.JPG

Here is a link to the page that I need help with (screenshot is below for reference):
hidden link

Using Toolset and Views, I have created a list of Exhibitors. What I need is for the date at the top of the list to update automatically whenever a new exhibitor is added, so that those visiting the page will know how current the list is.

Thank you for your assistance,
CommMgr

#1189916

Hi, there's not really a built-in way to display the latest update date for a View. Instead, you could create a second View that is filtered to show the same results, but ordered in descending chronological order by post date, and limited to only the first result. In the Loop editor of that View, insert the post date shortcode. Then insert this second View in the original View's table header. The nested View will output the date of the most recent matching post. Let me know if you have questions about this.

#1189919

Hi, Christian...

Thank you for your quick reply. I am still rather new to views and coding the loops. So, yes, I will need help with how this code should be written. If you can instruct me on how to post my view code in this support thread, I will provide that to you as reference.

CommMgr

#1189971

Okay sure, you can post your View's Loop Editor code here by surrounding it in code tags. Click "Formatting instructions" above the comment editor to see examples of code tags and some other allowed HTML.

However, its fairly straightforward and I will try to explain it step by step. Create a new View, and choose "full custom display" in the setup popup. This will open up all the editor panels in the new View editor screen for complete customization. Once you're in that editor screen, choose the correct post type in the Content Selection area, then in the Ordering section choose Post Date - Descending order. In the Limit and Offset section, choose a limit of 1 post and no offset. Scroll down to the Loop Editor panel and click "Skip wizard" to start with a basic loop structure. Then place your cursor between the wpv-loop tags and click "Fields and Views", then "Post Date". You can choose from different date formatting options, then the system will automatically insert the post date shortcode in the loop. That's all the code you need to write for this View.

Then edit the existing View with the table, place your cursor where you want the date to appear and click "Fields and Views". Choose your new View, and the system will insert a shortcode for you automatically.

#1190572
LSW_exhibitor_list_date_updating_2lines.JPG

Hi, Christian...

Thank you for the step by step instructions. I was able to create the date view and put it in my original view code and it works.

However, I have a display problem with the date I need your help with. The date view code makes the "date" go on a separate line. I need the date to be inline with the rest of the text (see screenshot for reference).

Your assistance is greatly appreciated...
CommMgr

My view code for reference:

[wpv-post-body view_template="conference template"][wpv-layout-start]
	[wpv-items-found]
<table style="margin-bottom: 0;" width="100%" cellspacing="0" cellpadding="0" border="0"> 
		<tbody class="wpv-loop js-wpv-loop">
          <tr>
          <td style="border-style: solid none solid; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px; line-height: 1.3em; padding-left: 10px;" width="67%" valign="middle" align="left">EXHIBITORS (as of [wpv-view name="exhibitor-list-la-date-updated" limit="1" orderby="date" order="desc"])</td>
<td style="border-style: none none solid; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px; line-height: 1.3em" width="22%" valign="middle" align="center">AGENCY</td>
<td style="border-style: none none solid; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px;" width="11%" valign="middle" align="center">BOOTH</td>
</tr>
          	<!-- wpv-loop-start -->
          		<wpv-loop>     
		<tr>
			<td style="padding: 5px 0; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px; line-height: 1.3em; padding-left: 10px;" valign="middle" align="left"><a href="[types field="web-site-url" raw="true"][/types]" target="_blank">[types field="exhibitor-full-name"][/types]</a></td>
				<td style="padding: 5px 0; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px; line-height: 1.3em; text-align: center;" valign="middle" align="center">[types field='california-lighting-sales' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="CLS" width="auto" height="30" /></a>[/types][types field='california-lighting-sales' state="unchecked"][/types][types field='dsa-lighting' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="DSA" width="auto" height="30" /></a>[/types][types field='dsa-lighting' state="unchecked"][/types][types field='forman-and-associates' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="FA" width="auto" height="30" /></a>[/types][types field='forman-and-associates' state="unchecked"][/types][types field='light' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="L" width="auto" height="30" /></a>[/types][types field='light' state="unchecked"][/types][types field='performance-lighting-systems' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="PLS" width="auto" height="30" /></a>[/types][types field='performance-lighting-systems' state="unchecked"][/types][types field='plp-socal' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="PLP" width="auto" height="30" /></a>[/types][types field='plp-socal' state="unchecked"][/types][types field='total-lighting-concepts' state="checked"]<a href="<em><u>hidden link</u></em>" target="blank"><img class="alignnone size-full" style="vertical-align: middle;" src="<em><u>hidden link</u></em>" alt="TLC" width="auto" height="30" /></a>[/types][types field='total-lighting-concepts' state="unchecked"][/types]</td>
				<td style="padding: 5px 0; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 16px; line-height: 1.3em;" width="11%" valign="middle" align="center">[wpv-conditional if="( $(wpcf-booth-number) ne '' )"][types field="booth-number"][/types][/wpv-conditional]</td>
			</tr>
	</wpv-loop>	<!-- wpv-loop-end -->
		</tbody>
	</table>

	[/wpv-items-found]
[wpv-layout-end]
#1190587

Try the checkbox in the View editor that says "Disable the wrapping DIV around the View". It's just below the Loop editor. If that doesn't work, you can move the "EXHIBITORS as of(...)" text inside the nested View so it's all output together with the date.

#1190591

The "Disable the wrapping DIV around the View" worked.

THANK YOU SO MUCH!
CommMgr