Skip Navigation

[Gelöst] Layouts integration with The Events Calendar

Dieser Thread wurde gelöst. Hier ist eine Beschreibung des Problems und der Lösung.

Problem:
Can I use the events calendar with layouts?

Solution:
In the past, we have had problems with Events Manager, but that was when Layouts was an all-or-nothing proposition.
(Either uses it everywhere or nowhere and edit only the WHOLE Template)
If you used it, you had to use it on every page - and Event Calendar items where difficult to display.

You don't need to do this now, so you can use Layouts on a site and leave Events Manager to render the single event and event archive pages.

If you want to create custom single event and event archive pages (much like you would create custom WC product and shop pages) then, you can't use Layouts, still, with the Events Manager.
But it is not anymore the main purpose to let you edit the WHOLE template with Layouts.
Instead, Layouts focuses on "Front End Edit" and that focuses on

the_content()

only.

So you can use the Event Manager on a site with Layouts, but you can't use Toolset to customise it. (Presumably, the plugin comes with some options for customising the output itself)

The changes to Layouts mean this has gone from "you cannot use it at all when using Layouts" to "you can use it when using Layouts if not using a fully-integrated theme but cannot use Toolset to customise the plugin output".

0% of people find this useful.

This support ticket is created vor 7 Jahre. 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.

No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.

Sun Mon Tue Wed Thu Fri Sat
- - 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00 14:00 – 20:00
- - - - - - -

Supporter timezone: Asia/Ho_Chi_Minh (GMT+07:00)

This topic contains 29 Antworten, has 4 Stimmen.

Last updated by nicolaT-2 vor 6 Jahre, 8 Monate.

Assisted by: Beda.

Author
Artikel
#510883

Hello. I am trying to get Layouts to work with Modern Tribe's Event Calendar Plugin. I've read through quite a few support threads on the issue, and this one got me the closest: https://toolset.com/forums/topic/page-not-getting-layouts-applied/

Changing the theme's single.php as recommended in that thread changed viewing a single event from saying that no layout was found to what you see in the following link:

hidden link

As you'll see, most of the event's info is pulled before the header, then we see the template I've created with the header, a title I put in, the content (which is just the description) and the footer. Any ideas for getting all that information at the top between the header and the footer?

#510966

To me it seems you integrated layouts in a way that still calls the Theme's code, instead of using an If/else.

Or, perhaps both statements return true, as such both things are loaded.

Can I see the minimal integration you used?

There is no need to paste the entire Custom Code of that template, just how the Layout is called and how the Theme's Code is called, so I can see the If/Else and that should then allow me to see what's wrong.

You can see here a Theme that is integrated properly with Layouts, in a way that lets you either use Layouts or not, even if it's active on the site (it does not force you to use it):
hidden link

#511756

I forgot to mention that I'm using the Toolset Starter theme, which I would hope would be integrated already. The integration I used from the support thread I linked to was to change the single.php to the following (I'm posting it all because I don't know much PHP - which is why I use toolset!):

<?php
if ( ! defined( 'ABSPATH' ) ) {
    die( '-1' );
}
   
if ( defined( 'WPDDL_VERSION' ) ) :
    get_header( 'layouts', 'events-default');
        the_ddlayout( 'events-default' );
    get_footer( 'layouts' );
else:
   
get_header();
?>
<div id="tribe-events-pg-template">
    <?php tribe_events_before_html(); ?>
    <?php tribe_get_view(); ?>
    <?php tribe_events_after_html(); ?>
</div> <!-- #tribe-events-pg-template -->
<?php
get_footer();
   
endif; ?>
#512485

OK; the Toolset Starter theme is of course integrated with Layouts.

What is special with that Theme is that if you have layouts active, you MUST use it on all your content.

Now, with your Code you added to the single.php template you check if Layouts is active (NOT if it's assigned to the current post) and if yes, you apply a default layout.
If Layouts is NOT active, you apply some events-plugin code.

Now, I see on the link you shared, that you do have a Layout assigend to that Event, is that correct?

So in this case you need to add one more check.
OR, you need to unassign Layouts from that post.

I am not sure if you want to style those posts with Layouts, or not.

If you do want to style them with Layouts you should not need any special Code.
If you do not want this, you need to add this code snippet:

if ( defined( 'WPDDL_VERSION' ) && is_ddlayout_assigned()) : 

Instead of

if ( defined( 'WPDDL_VERSION' ) ) :

That will check if Layouts is active AND assigned to the Post.

If both is not true, it will apply your custom Code below.

The problem also is, I am not sure if that plugin really uses the single.php to display events.
It might be they use a Custom Template, or similar.

#513187

I definitely need some kind of layout here, because I need the site's headers and footers from the parent layout.

Implementing your code, what I get now can be seen here: hidden link

I get all the content called from the Event calendar event first, then the header, then the layout including the events content, because I have a content block in the layout, then the footer. What I'd like is to put everything from the event (everything from where it says "All events" to where it says "The People's Studio: Visual Art >>" as a link on the right above the People's Colloquium logo.) and put it where the content block stuff is now (under "Calendar" and above the footer.

The Events Calendar definitely does do things differently - there are a ton of threads on Toolset support of people having issues with it, and lots of proposed solutions, I just can't figure out how to make one of them work for my case. You even helped someone with one of them a few years back: https://toolset.com/forums/topic/integrating-modern-tribe-the-events-calendar-with-layouts/

Thanks!

#513925

The entire page you show me is created by a Layout Row.

This means the content above the header is output by Layouts, it is a ddl-full-width-row row and that is only Layouts that produces such markup.

I suspect you either use a ShortCode that echoes the contents which is wrong, it should return it, or the Events Plugin echoes the content soemhow instead of returning it.

I need to see this on the site and I will need to edit code and contents.

Please add the exact steps to replicate, the places where you edit and add code or layouts, and access to (if possible) a Test Site, where I can see and try to adjust the code.

No other Plugins but the needed ones should be used and if possible the Starter Theme should be active.

Thank you

#514682

You chose the default PAGE template.
This is not the single.php but the page.php.

Toolset Starter, both the single.php and page.php automatically load Layouts if Layouts is active.

You do not need to add any code in there.

This must work out of the box.

Please remove all code, or maybe easier, re-download the Toolset Starter Theme, and that should then work just fine.

#515016

It does not work out of the box, hence the many support threads in this forum on difficulties between the very popular Event Calendar plugin and Layouts. I downloaded the Toolset Starter theme and activated it, and am back to where I started: an error on an event page saying: "You need to select a layout for this page. The layout selection is available in the page editor." This is when I have "Default Page Template" selected in the Event Calendar settings under Events Template. When I select "Default Event Template", my only other choice for Events Template, I get what you see here: (hidden link - the navigation menu displayed differently than on the rest of the site, but no logo and no footer.

#515168

I need a copy of the Plugin since it's a Paid Software.

I will then make the needed tests and report either back to you or to the Developers.

Please share the latest version of the plugin with me, in a ZIP folder uploaded to Google Drive.

Thank you

#515999

Google Share can be done with "anyone who has this link".

This is the way you can share that folder with me.

I reactivated the private reply.

#516634

Ah, I didn't know that about Google Drive. Here you go: <removed>

#517294

OK; I can not successfully use Layouts with it.

But I have a problem.
This plugin uses very specific contents, also Custom Fields.
How would you even display those Fields in a Layout, since that Plugin has no ShortCodes to display those Fields?

So you would need to control those Fields with Types or display them elsehow with ShortCodes.
This makes it equivalent to not use the Plugin as you could then simply use Types and the rest of Toolset.

If you customise the template with Layouts you would have to recreate the whole template and create a great set of custom codes to display its contents.
Please correct me if I am wrong on this one.

As such, I see no good at all if it is displayed with Layouts, as it would simply display nothing.
That Plugin barely uses the content and ShortCodes so you cannot really display it elsewhere but with their hardcoded templates.

But, I can not just leave this here.

We will analyse, think, and eventually provide some workaround or solutions.
For this purpose, I am escalating this ticket to myself in Second Tier and will provide a solution ASAP.

Meanwhile, do you have any idea how you actually would display that Event using ShortCodes or similar, maybe you have a greater understanding of the plugin since you seem to use it widely?

#517579

Thanks for escalating this issue. It's definitely one that seems to come up on this support forum again and again - both the free and paid version of this plugin are very widely used.

I think the potential solution lies in the plugin's ability to select a page template which controls how the event pages are shown. It can be found in Events -> Settings -> Display, in the dropdown "Events template." That's how I've gotten it to work on other sites.

Other support threads seem to go the route of creating a template, or modifying an existing one, to call a layout's header and footer, and then have the plugin put all its content in between. I just couldn't quite get that to work, so ended up with the plugin's content in the wrong place.

#517724

1. I think the potential solution lies in the plugin's ability to select a page template which controls how the event pages are shown. It can be found in Events -> Settings -> Display, in the dropdown "Events template." That's how I've gotten it to work on other sites.

Yes, but that is exactly what not works.

Default Page will say "assign a layout", and default Plugin template will just not apply Layouts at all.

My question is, how do you even display Event Content in a Layout.
Let's assume for one minute, we can apply a layout.
We can still not display the event, as that plugin has no ShortCodes to display it and stores basically no crucial data in the Post Content but only in Custom Fields.
Yes those could be controlled by Types or added as Post Fields, but the whole format and style would need to be recreated.

So, probably the only solution here is to call the whole template of the plugin but another header and footer, by Layouts.
And that is not possible, as you would need to have a Child Layout calling that template, and it's not possible to call templates with Layouts.

I will dig into this, but I see forcoming a problem here.

2. Other support threads seem to go the route of creating a template, or modifying an existing one, to call a layout's header and footer, and then have the plugin put all its content in between. I just couldn't quite get that to work, so ended up with the plugin's content in the wrong place.

Yes, that is what I will try. But it's a Custom Code solution, I will first try a GUI solution.

#517970

Thanks again. Yeah, when I did start trying the custom code solutions, I got close, calling both the header and footer and the Event content, just not in the right order, and it solved the "No Layout found" error. But if you could find a GUI solution, even better. Cheers.

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