Support

Home Forums Event Espresso Premium EE4 [ESPRESSO_EVENTS] Shortcode Doesn't Work

EE4 [ESPRESSO_EVENTS] Shortcode Doesn't Work

Posted: November 10, 2015 at 3:42 pm

Viewing 11 reply threads


ATSI

November 10, 2015 at 3:42 pm

Hello,

When I put the [ESPRESSO_EVENTS] shortcode on one of my site’s pages it stops the page from completely loading and doesn’t show any events. See the following for an example.

http://www.atsicad.com/test/

This page has nothing but [ESPRESSO_EVENTS] on it. I am using the Avada theme and have a child them installed. Everything else seems to work well.

Any help appreciated.


Lorenzo Orlando Caum

  • Support Staff

November 10, 2015 at 3:53 pm

Hi, I’m interesting in hearing more about this:

When I put the [ESPRESSO_EVENTS] shortcode on one of my site’s pages it stops the page from completely loading and doesn’t show any events.

Could you try adding a couple words before and after the shortcode like this?

Test

[ESPRESSO_EVENTS]

Test

The reason why I ask is I see that your events calendar page which uses an Event Espresso shortcode works just fine.


Lorenzo


ATSI

November 10, 2015 at 4:31 pm

OK, I added the line above and below the shortcode and as you can see the first line prints then the shortcode crashes the page. You are correct, the shorcodes for the calendar add-on that I purchased and installed today work fine. What would you like me to try next?


ATSI

November 10, 2015 at 4:41 pm

Correction…neither of the lines before or after the shortcode printed.


ATSI

November 10, 2015 at 5:51 pm

After doing some digging around in the EES_Espresso_Events class I worked through the process_shortcode function and commented out all but the return. The test page loaded fully. I then commented out less and less until the page crashed. The line causing the crash was the following:

EED_Events_Archive::instance()->template_include( ‘loop-espresso_events.php’ );

After commenting just this line out the page loads and the events are show. I have a custom loop-espresso_events.php template, but renaming it so that it reverted back to the default didn’t help the crash with the above line being executed. I’m not quite sure why it seems to fully work with this line commented out, but it does. It even uses my custom loop-espresso_events.php template file.

Can you shed any light on this?


Tony

  • Support Staff

November 11, 2015 at 3:06 am

That’s odd.

Can you enabled WP_DEBUG and see if any errors are being thrown with that line above active please?


ATSI

November 11, 2015 at 6:35 am

Tony,

I enabled WP_DEBUG inside the function as shown below. If this is the correct way to implement it then it didn’t throw an error. The page just breaks. If I am not using WP_DEBUG correctly then let me know. If I am, then please tell me what else you would like me to try.

public function process_shortcode( $attributes = array() ) {
define( ‘WP_DEBUG’, true );
// make sure EED_Events_Archive is setup properly
if ( apply_filters( ‘FHEE__fallback_shortcode_processor__EES_Espresso_Events’, FALSE )) {
EED_Events_Archive::instance()->event_list();
}
// merge in any attributes passed via fallback shortcode processor
$attributes = array_merge( (array)$attributes, (array)$this->_attributes );
//set default attributes
$default_espresso_events_shortcode_atts = array(
‘title’ => NULL,
‘limit’ => 10,
‘css_class’ => NULL,
‘show_expired’ => FALSE,
‘month’ => NULL,
‘category_slug’ => NULL,
‘order_by’ => ‘start_date’,
‘sort’ => ‘ASC’,
‘fallback_shortcode_processor’ => FALSE
);
// allow the defaults to be filtered
$default_espresso_events_shortcode_atts = apply_filters( ‘EES_Espresso_Events__process_shortcode__default_espresso_events_shortcode_atts’, $default_espresso_events_shortcode_atts );
// grab attributes and merge with defaults, then extract
$attributes = array_merge( $default_espresso_events_shortcode_atts, $attributes );
// make sure we use the_excerpt()
add_filter( ‘FHEE__EES_Espresso_Events__process_shortcode__true’, ‘__return_true’ );
// apply query filters
add_filter( ‘FHEE__EEH_Event_Query__apply_query_filters’, ‘__return_true’ );
// run the query
global $wp_query;
$wp_query = new EE_Event_List_Query( $attributes );
// check what template is loaded and load filters accordingly
EED_Events_Archive::instance()->template_include( ‘loop-espresso_events.php’ );
// load our template
$event_list = EEH_Template::locate_template( ‘loop-espresso_events.php’, array(), TRUE, TRUE );
// now reset the query and postdata
wp_reset_query();
wp_reset_postdata();
EED_Events_Archive::remove_all_events_archive_filters();
// remove query filters
remove_filter( ‘FHEE__EEH_Event_Query__apply_query_filters’, ‘__return_true’ );
// pull our content from the output buffer and return it
define( ‘WP_DEBUG’, false);
return $event_list;
}


Tony

  • Support Staff

November 11, 2015 at 6:49 am

You can defined WPDebug from within a function, you need to do it within your wp-config.php file.

Remove the code mentioned above, then using FTP navigate to your wordpress root directory and you’ll find wp-config.php there.

Add define( ‘WP_DEBUG’, true ); to that somewhere above the line:

/* That’s all, stop editing! Happy blogging. */

Like this – http://take.ms/JJQds

Then reload that page.


ATSI

November 11, 2015 at 7:04 am

Here’s the error. It obviously doesn’t like the fact that I have the pagination function in my child theme’s functions.php. I don’t even remember why I put it there, it might have been for a previous version.

Fatal error: Cannot redeclare espresso_pagination() (previously declared in /home/orthahee/public_html/atsicad/wp-content/themes/Avada-Child-Theme/functions.php:21) in /home/orthahee/public_html/atsicad/wp-content/plugins/event-espresso-core-reg/public/Espresso_Arabica_2014/functions.php on line 39


Lorenzo Orlando Caum

  • Support Staff

November 11, 2015 at 8:11 am

Hi, could you try commenting espresso_pagination out and re-testing?


Lorenzo


ATSI

November 11, 2015 at 8:32 am

I did that and it works fine now. Like I said, somewhere along the line I was told to put the pagination function in my child theme’s functions.php file but I can’t remember why.


Lorenzo Orlando Caum

  • Support Staff

November 11, 2015 at 8:48 am

Alright, great! That may have been in a gist on GitHub that I shared on the support forums for starter templates. That was updated some time ago.


Lorenzo

Viewing 11 reply threads

The support post ‘EE4 [ESPRESSO_EVENTS] Shortcode Doesn't Work’ 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