Support

Home Forums Event Espresso Premium Changing the event_list_display file to a different file?

Changing the event_list_display file to a different file?

Posted: January 20, 2013 at 9:25 pm

Viewing 5 reply threads


Jason Allen

January 20, 2013 at 9:25 pm

I’ve looked over this post: https://eventespresso.com/topic/load-different-event_list_display-on-different-pagespost/ and I want to do this same thing, but can’t figure out where exactly to change this.

I need to have my new custom shortcode (contained in the custom_shortcode.php file) point to a different event_list_display file than everything else.

Any help is appreciated!
j.


Josh

  • Support Staff

January 21, 2013 at 8:42 am

Hi Jason,

I’m thinking you’re modifying a copy of the EVENT_LIST shortcode? If so, then your new shortcode can point to a copy of event_list.php. At the end of event_list.php, it includes event_list_display.php. You can change that code in your copy of event_list.php to include the template file you’d like to use.


Jason Allen

January 21, 2013 at 1:30 pm

Hi Josh – thanks!
You are right, I’m modifying the EVENT_LIST shortcode.The problem is – I still want to use it as is, and my new version. So if I change the event_list.php to point to a different event_list_display.php, then it will change it for all my EVENT_LIST shortcodes.

To put it another way, I have a new shortcode, EVENT_LIST-HOMEPAGE. I need just that shortcode to to look at a different event_list_display.php file to do some custom formatting on it.

Thanks so much for the help!
j.


Jason Allen

January 21, 2013 at 1:54 pm

Ok, so maybe I need a conditional include? I’m trying this:

   if ( is_front_page() ) {
    include('event_list_display-HOMEPAGE.php');
   } else {
    include('event_list_display.php');
    }

But it’s not working. I’m not great at this, so maybe it’s just an obvious syntax problem? Thanks!
j.


Jason Allen

January 21, 2013 at 3:05 pm

i think my real question is – how do i point my custom shortcode (a modified copy of EVENT_LIST shortcode) to my modified copy of event_list.php (which points to a modified copy of event_list_display.php)?


Josh

  • Support Staff

January 21, 2013 at 4:43 pm

Hi Jason,

Your custom shortcode could point to a modified event_list.php via a function. Remember though, you should prefix the functions so you don’t have duplicate function names.

So if you look at the original function in /includes/shortcodes.php that adds the [EVENT_LIST] shortcode, you’ll see that it’s calling the event_espresso_get_event_details function, which is the big function in event_list.php. You could copy that function rename it, and paste it into your custom functions file and modify that one to load up your custom template.

The conditional idea would be less code duplication, and it looks like it would work, but you’d need to make sure that all the event_list templates are copied over to /wp-content/uploads/espresso/templates. To clarify, if event_list.php is not in /wp-content/uploads/espresso/templates, it will load the template from the plugin directory, and the paths are relative, so it will only look for the event_list_display.php template in its own directory.

Viewing 5 reply threads

The support post ‘Changing the event_list_display file to a different file?’ 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