Skip Navigation

[Resolved] How to make content appear in loop depending on date and time

This support ticket is created 6 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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 2 voices.

Last updated by CommMgr 6 years, 10 months ago.

Assisted by: Shane.

Author
Posts
#539276

I am using Toolset for our conference program.

We need a page that will list each session in the day and time slot it appears.

I created a loop that lists each session, it's number, title, speaker names and learning units. All the sessions are in one long list. (see code below for reference)

Now I need to learn what conditional code to use so that a session will appear in the list according to its day/time. Please see the conference page we had last year that I created manually in a table. I need my Toolset content to appear similarly. hidden link

Example of days times are:
Wednesday 9:00 - 10:00am
Wednesday 2:00 - 3:00 pm
Thursday 11:00 - 12:00 pm
Thursday 3:00 - 4:00 pm

I have custom fields in checkboxes for the days and for each time individually.

Thank you for your assistance.
CommMgr

[wpv-post-body view_template="conference template"][wpv-layout-start]
	[wpv-items-found]
	<!-- wpv-loop-start -->
	
<table style="background-color: #efefef;" width="100%" cellspacing="0" cellpadding="0" border="0">
		<tbody class="wpv-loop js-wpv-loop">
			<wpv-loop>
<tr>
<td style="padding: 10px 0 10px 10px; border-top: none; border-bottom: thin solid #bfbfbf; font-size: 14px; line-height: 1.4em;">
<div style="font-weight: 600;">[wpv-conditional if="( $(wpcf-sold-out) ne '' )"][types field='sold-out' state='checked']<img src="<em><u>hidden link</u></em>" alt="SOLD OUT" width="90" height="16">[/types][types field='sold-out' state='unchecked'][/types]&nbsp; [/wpv-conditional]<a href="[wpv-post-url]">[types field='session-number'][/types] - [types field='session-title'][/types]</a></div>

[wpv-conditional if="( $(wpcf-type-of-speaker) ne '' )"]
<div style="padding-top: 2px;">[types field='type-of-speaker'][/types]:</div>[/wpv-conditional]

[wpv-conditional if="( $(wpcf-speaker-1-name) ne '' )"]
<div><span style="font-weight: 600;">[types field='speaker-1-name'][/types]</span><br />
[types field='speaker-1-title'][/types] - [types field='speaker-1-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-speaker-2-name) ne '' )"]
<div style="padding-top: 2px;"><span style="font-weight: 600;">[types field='speaker-2-name'][/types]</span><br />
[types field='speaker-2-title'][/types] - [types field='speaker-2-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-speaker-3-name) ne '' )"]
<div style="padding-top: 2px;"><span style="font-weight: 600;">[types field='speaker-3-name'][/types]</span><br />
[types field='speaker-3-title'][/types] - [types field='speaker-3-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-speaker-4-name) ne '' )"]
<div style="padding-top: 2px;"><span style="font-weight: 600;">[types field='speaker-4-name'][/types]</span><br />
[types field='speaker-4-title'][/types] - [types field='speaker-4-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-moderator-name) ne '' )"]
<div style="padding-top: 2px;">MODERATOR - <span style="font-weight: 600;">[types field='moderator-name'][/types]</span><br />
[types field='moderator-title'][/types] - [types field='moderator-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-facilitator-name) ne '' )"]
<div style="padding-top: 2px;"><span style="font-weight: 600;">[types field='facilitator-name'][/types]</span><br />
[types field='facilitator-title'][/types] - [types field='facilitator-company'][/types]</div>
[/wpv-conditional]

[wpv-conditional if="( $(wpcf-learning-units) ne '' )"]
<div style="font-style: italic; font-size: 14px; padding-top: 2px">Qualifies for: [types field='learning-units'][/types]</div>[/wpv-conditional]</td>
</tr>
	</wpv-loop>
		</tbody>
	</table>
	<!-- wpv-loop-end -->
	[/wpv-items-found]
	[wpv-no-items-found]
		<strong>[wpml-string context="wpv-views"]No items found[/wpml-string]</strong>
	[/wpv-no-items-found]
[wpv-layout-end]
#539286

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

Thank you for contacting our support forum.

What you're trying to setup is essentially a timetable correct?

This would be possible but you will need to setup multiple views for this. For e.g you will need to create a view for each of the days. then filter that view to only lists the posts for that day.

Then you will need to order the display by the time custom field. There would still be a challenge when it comes to the time groupings.

I dont think views will be the best tool for this. This tool seems to be able to achieve what you want.
https://wordpress.org/plugins/mp-timetable/

Thanks,
Shane

#539309

Hey, Shane...

Well, thanks for the Timetable plugin suggestion. However, we purchased Toolset so we could use just one program for our conference.

So, you mentioned This would be possible but you will need to setup multiple views for this. For e.g you will need to create a view for each of the days. then filter that view to only lists the posts for that day.

Could you please give me the exact code for that "filter"...possibly using my code above in the example?

I can probably figure out how to order the display by the time custom field.

Thanks for your assistance.
CommMgr

#540219

Hi, Shane...

Thank you for reopening this thread.

As mentioned above, could you please give me the exact code for that "filter"...with detailed instructions on where to put it in my functions.php file?

Also, what conditional code do I need to add to my existing code (posted below) to make that filter work? (this is the code I shared in the original post) As a reminder, I am still learning conditional coding so I need to know exactly where to put the code.

Your assistance is appreciated,
CommMgr

#540223

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

combination.png
filter-example.png

Hi Chris,

Let me provide a few screenshots on the scenario.

So lets say we have a select custom field where we have the Days of the week.

Then we select for 1 session that it should be on Mondays. Now we will need to create a view that will list the posts for each day respectively so in essence 7 views will be needed.

So we will filter each view based on the day of the session so each view will display posts for a different day. See Screenshot for filter example

This filter will allow the view to display all the posts that are set for Monday. This is just an example in the simplest form.

For your specific case you have time sub divisions meaning your posts are separated by days and by time.

So you will need 2 filters for each view and that will take the amount of views from just 7 to 7 times the amount of hourly subdivisions.

Finally you view filter will look something like this. See Combination screenshot.

Now here we have a view that will list out All the sessions for Mondays between the times of 8:00am - 9:00am

Ofcourse you will need to setup a custom field with these time divisions as well in order to filter for them.

Please let me know if this is clear 🙂 if there is anything you are unsure about please let me know.

Thanks,
Shane

#540230

Hi, Shane...

The screenshots you provided...I am not sure where I would find those sections.

I am using the Divi theme, however I am not using Toolset Layouts plugin. Only using Toolset Types and Toolset Views.

Not sure that is why I am unable to locate where you are getting those screenshots.

CommMgr

#540274

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Chris,

Sorry about that 🙁

This section is actually location under "Query Filters" when you are editing or creating a new view.

Take a look at the link below
https://toolset.com/documentation/user-guides/filtering-views-by-custom-fields/

Please let me know if this helps.
Thanks,
Shane

#540580

Hi, Shane...

I can't thank you enough for your GREAT customer support. I was able to get our conference sessions listed on the page correctly.

Appreciate your assistance...
CommMgr

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