Hi there
We use the Events Calendar by Modern Tribe (hidden link) to post events and to integrate them with external services. Rebuilding all those features on our own would take too much time, therefore we stick with that solution.
However, we would like to visually align how the events look. I was able to enable the custom fields and can use them in a View. But so far I wasn't able to get the fields to show in a layout. I did some research here and found some posts (e. g. https://toolset.com/forums/topic/creating-layout-for-a-single-event-with-modern-events-calendar/ and https://toolset.com/forums/topic/toolset-layouts-and-modern-tribe-the-events-calendar-integration/). Is it correct, that I can create a View to display Events but I'm not able to create a custom layout for those?
If this is true, I thought of using a View that I put in the layout and that should display the fields of the current post. But I can't get that to work. Is that even possible?
And is there any chance to use Toolset to create a layout for the events of the Events Calendar by Modern Tribe?
Thanks for your help!
Best,
Marcial
Is it correct, that I can create a View to display Events but I'm not able to create a custom layout for those?
Yes, that is correct. You can create a View to display Events, but you cannot create a Template Layout for Event posts and you cannot create a Content Template to display Event posts.
If this is true, I thought of using a View that I put in the layout and that should display the fields of the current post. But I can't get that to work. Is that even possible?
What do you mean "in the layout"? As I said, you cannot create a Template Layout for Event posts, and you cannot create a Content Template to display event posts. So I'm not clear which layout you're describing. Can you clarify for me?
And is there any chance to use Toolset to create a layout for the events of the Events Calendar by Modern Tribe?
It would require a significant amount of custom code, and is outside the scope of support we provide here in the forums. Their proprietary system uses custom templates that don't fit in the normal WordPress templating system.
Hi Christian
That's a bummer. I see that it's not on your side to provide a solution for that.
What I was asking was this:
As I was able to get a View for the Events to work, I wanted to implement a new view that loads all the fields there are and display it in an extended view. By disabling "Don't include current page in query result" and by filtering the ID of the post with [wpv-post-id], I was hoping to be able to load the view within the layout of the event. That actually works, but the view is empty. You can check that here: hidden link
The word "Test" comes from text written within the layout I assigned to the CTP "Events" (that is generated by the plugin mentioned).
The "No items found" is the view that isn't able to get any results.
I have a small hope that it's just my view that isn't correctly set up to achieve the desired result.
I hope you can see what I'm trying to achieve.
Best,
Marcial
...and by filtering the ID of the post with [wpv-post-id], I was hoping to be able to load the view within the layout of the event.
Can you show me how are you filtering by wpv-post-id? Is this set in a shortcode attribute, or set directly in the View's Query Filter?
I tried both. Currently it is set in the query filter (see attachement 1). And the view is implemented via it's module in the layout (attachement 2). But before that I did configure the view to use the shortcode attribute and inserted the shortcode in the layout in a normal text field. I even hardcoded the ID in the view itself. Still no result.
You should select "posts with IDs set by the shortcode attribute" in the Query Filter configurations. Then in the Layout, you should not use a View widget. Instead, use a Visual Editor widget and place the View using the Fields and Views button. In the popup, you will have the ability to set the Query Filter options. This is where you should use wpv-post-id (see the screenshot). The system will generate the proper shortcode syntax for you automatically.
Let me know if you have questions about that.
Hi Christian
I get an error in that case: "Please enter a valid comma separated number list". I attached a screenshot of the view and the layout.
Thanks for your help.
Best,
Marcial
Okay I see, in this case you can enter "1,2" or some comma-separated list of numbers. It does not matter what you choose because you will overwrite those choices in the next step. The system will generate a shortcode for you automatically, then you can replace the comma-separated numbers with the wpv-post-id shortcode. See the screenshots here.
Hi Christian
I did set it up as you described. It still shows no results.
On this URL (hidden link), I implemented the view in a normal page without shortcode attribute.
[wpv-view name="events-calendar"]
That works just fine.
In the layout, I have the same view including the shortcode attribute:
[wpv-view name="events-calendar" ids="wpv-post-id"]
Here it doesn't work.
Do you have another idea what could help?
Best,
Marcial
You should use the wpv-post-id shortcode, like this:
[wpv-view name="events-calendar" ids="[wpv-post-id]"]
Without the shortcode brackets, it will not work correctly.
Okay it would probably be best for me to log in and see what's going on. Please provide login credentials here in the private reply fields.
Okay I don't expect it to work on the single Event page, and I don't expect Layouts or Content Templates to be completely functional on the single Event page either. As I said, there are known issues when trying to design the single post for Events. For example, if I place the View on the single Event page using the same shortcode attributes and debug the query, it looks like this:
SELECT DISTINCT wp_posts.*, MIN(wp_postmeta.meta_value) as EventStartDate, MIN(tribe_event_end_date.meta_value) as EventEndDate FROM wp_posts LEFT JOIN wp_postmeta as tribe_event_end_date ON ( wp_posts.ID = tribe_event_end_date.post_id AND tribe_event_end_date.meta_key = '_EventEndDate' ) WHERE 1=1 AND wp_posts.ID IN (94) AND wp_posts.post_type = 'tribe_events' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')) ORDER BY EventStartDate DESC, wp_posts.post_date DESC
On a Page, the same View's query looks like this:
SELECT wp_posts.* FROM wp_posts WHERE 1=1 AND wp_posts.ID IN (94) AND wp_posts.post_type = 'tribe_events' AND ((wp_posts.post_status = 'publish' OR wp_posts.post_status = 'private')) ORDER BY wp_posts.post_date DESC
You can see that in the Event single post template, the event plugin is adding a lot of extra information to the query, and Toolset doesn't have a good way to filter that out reliably. If you place the View on a different Page, you can't expect wpv-post-id to work because the ID is a Page, not an Event. So you would have to use a hard-coded number there, or another shortcode. I hard-coded a number in this example:
hidden link
Hi Christian
Thank you so much for your tireless efforts! Too bad, we didn't make it work. Fortunately we can build the rest of the website with Toolset.
Best,
Marcial