Skip Navigation

[Résolu] Views Shortcode Attributes Not Filtering Correctly

This support ticket is created Il y a 7 années et 3 mois. 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.

Marqué : 

This topic contains 2 réponses, has 2 voix.

Last updated by scottD-2 Il y a 7 années et 3 mois.

Assigned support staff: Ivan.

Auteur
Publications
#339803
query-setup.png
database-event-host.png

I am trying to use the Views shortcode to display filtered results. The query filter I am using is for an events calendar where events are hosted by one of two parties.

I want the calendar to show any events with the custom field Event End Date greater or equal to today (i.e. don't show past events) - this part I have working correctly. (See query-setup.png)

I also want to show events hosted by members and events hosted by the company on different pages, so I set up another filter where the custom field Event Host is equal to the shortcode parameter "host". In the shortcode I'll use

[wpv-view name="Events Calendar" host="WVAC Event"]

to show the company results, as this is what this field saves to the database. (See database-event-host.png).

When I use the shortcode this way, it displays no results.

However, when I modify the query filter so that the event host field is equal to a constant of "WVAC Event", and remove the host parameter from the shortcode, it shows the events correctly.

I don't want to use the constant since that would then require an additional view for the member events. Since the layout will be identical between the two types of events I really want to avoid creating the second view. Using the constant seems to verify that the correct value is being used, but for some reason the shortcode will not use the value set in "host" correctly.

Am I not using this correctly?

#339883

Ivan
Supporter

Languages: Anglais (English )

Hello Scott,

From your description and screenshots everything seems configured correctly,

I would like to request temporary access (wp-admin and FTP) to your site to take better look at the issue. You will find the needed fields for this below the comment area when you log in to leave your next reply. The information you will enter is private which means only you and I can see and have access to it.

Also, here is one useful link related with this topic: https://toolset.com/documentation/user-guides/passing-arguments-to-views/

Thanks, Ivan

#340044

Thanks for your time with this issue. After taking another look at it, I realized what went wrong.

Originally, all events were going to be shown on the same calendar with an image indicating whether they were member events or the company's events. Since it was all on the same page, I made an archive page for this CPT.

When we decided to break the events into two separate pages I accidentally created a second archive page for the same post type, which caused the original archive page to stop being used for that CPT. This made it look like there were no results that matched the date/event type criteria when in reality there were plenty that should have shown up.

The fix was simple in case anyone else has this issue.

Put the view shortcode on two separate WordPress pages and remove the archive page as it is no longer needed.