Support

Home Forums Event Espresso Premium EE4.9 PHP fatal error on espresso_get_template_part

EE4.9 PHP fatal error on espresso_get_template_part

Posted: June 24, 2016 at 8:21 am


marijn

June 24, 2016 at 8:21 am

I’m using:
espresso_get_template_part( ‘content’, ‘espresso_events-details’ );
in my child theme and after updating to EE4.9 my site stopped working providing the following error in the log.
I quickly reverted to the previous 4.8.43 and it’s working normally again


Tony

  • Support Staff

June 24, 2016 at 9:27 am

Hi there,

Looks like the error isn’t included within your post, can re-post the error please?


marijn

June 25, 2016 at 1:06 am

Hi,
yes here it is.
2016/06/24 16:04:23 [error] 29664#0: *273134 FastCGI sent in stderr: “PHP message: PHP Fatal error: Uncaught Error: Call to undefined function espresso_get_template_part() in /wp-content/themes/x-child/single-reis.php:82

line 82 in single-reis.php reads:
espresso_get_template_part( ‘content’, ‘espresso_events-details’ );

  • This reply was modified 7 years, 10 months ago by  Tony. Reason: Remover server path


Josh

  • Support Staff

June 27, 2016 at 8:10 am

Hi Marijn,

It was quite likely that you didn’t get a fatal error with the older version of Event Espresso. You can wrap your code in a check for the function to avoid fatal errors. Here’s an example:

if ( function_exists( 'espresso_get_template_part' ) ) {
	espresso_get_template_part( 'content', 'espresso_events-details' );
}


marijn

June 27, 2016 at 8:30 am

Hi, Ok that I get.
But is this function removed or something? It was working before…


Josh

  • Support Staff

June 27, 2016 at 9:50 am

No functions were removed, but if your template is loading on a non – Event Espresso route it could throw a fatal error because Event Espresso doesn’t load everything all the time.


marijn

June 28, 2016 at 2:19 am

Ok, how to make sure EE is loaded then in this case (CPT which includes theEE event).
Also can you give any suggestion as to why it always worked without errors or even warnings. Nothing has changed on the site.


Josh

  • Support Staff

June 28, 2016 at 7:02 am

It was likely that before Event Espresso shouldn’t have been loading everything on a non-CPT route, then that bug was fixed. So your code worked only because of a happy accident.

The support post ‘EE4.9 PHP fatal error on espresso_get_template_part’ is closed to new replies.

Have a question about this support post? Create a new support post in our support forums and include a link to this existing support post so we can help you.

Event Espresso