Support

Home Forums Event Espresso Premium Past event archive – old topic to be reviewed

Past event archive – old topic to be reviewed

Posted: August 12, 2019 at 6:15 pm

Viewing 7 reply threads


liatoss

August 12, 2019 at 6:15 pm

Hi, several years ago I already asked you about the same subject. Hereby is the topic: https://eventespresso.com/topic/event-list-how-to-have-2-upcoming-and-past-events-blocks/

I built the template and added the filter into the functions.php. However, the page hangs… Are there any changes with regard the actual version of EventEspresso in your 2years old code from here: https://gist.github.com/joshfeck/56bc9e4a3683779fe90f? If there are no changes, it looks like I made some errors in my code.

Thx, Vlad.


Tony

  • Support Staff

August 13, 2019 at 3:42 am

Hi there,

When you say the page hangs, what happens? A completely white screen?

The above snippet is working fine for me so I’m guessing there’s a syntax error in your template/functions.php file.

If you enable WP_DEBUG and retest the template does it show any errors?


liatoss

August 13, 2019 at 7:22 am

Thank you, i found an error in my code, everything works but it mixes several languages. I use WPML for multilingual support, is there any way to filter the list of posts by current language?

Thx, Vlad.


Tony

  • Support Staff

August 13, 2019 at 7:35 am

Officially EE doesn’t support WPML at this time, so not that I’m aware of.


liatoss

August 13, 2019 at 7:42 am

And is there any way to make this code working for a shortcode instead of the page template?


Josh

  • Support Staff

August 16, 2019 at 10:03 am

Yes the code can be adapted to do a shortcode. Here’s an example:

https://gist.github.com/joshfeck/2f8c67a51ebeec117c7dc3a5cb4e0051


liatoss

August 19, 2019 at 10:48 am

Fantastic, now it is more clear how to build shortcodes. But I am notr sure I understand to which place those files to…

If I put the code of file ee_shortcode_past_events.php in the function.php of my child theme, it works.

But can it be placed some where else in order to keep the original files?

Another problem is multilingual support. I do know that EE4 doesn’t support WPML, but as far as I can see, I can add into the WHERE conditions a code of current language in order to get the list only on the selected language. Am I right?

I will add required code here later on…

Thx, Vlad.


Josh

  • Support Staff

August 19, 2019 at 1:37 pm

If you put the code into a child theme’s functions.php file, you’d need to change the following line:
$html = include_once( plugin_dir_path( __FILE__ ) . '/shortcode-template.php' );

to be:

$html = include_once( get_stylesheet_directory() . '/shortcode-template.php' );

Then, you place the shortcode-template.php template from the gist into the child theme folder.

If you prefer to not add the code to a child theme, you could put all the code into its own plugin by following this guide:
https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/

but as far as I can see, I can add into the WHERE conditions a code of current language in order to get the list only on the selected language. Am I right?

I do not believe so, no.

Viewing 7 reply threads

The support post ‘Past event archive – old topic to be reviewed’ 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