Skip to content

Instantly share code, notes, and snippets.

@lorenzocaum
Last active November 18, 2015 15:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lorenzocaum/a33405557a2a065779ea to your computer and use it in GitHub Desktop.
Save lorenzocaum/a33405557a2a065779ea to your computer and use it in GitHub Desktop.
Change order on single event pages in Event Espresso 4 to event image, event description, ticket selector, datetime... #optimization

The following filters are no longer recommended as a way to adjust the order of the event elements in Event Espresso 4. As of Event Espresso 4.8.21, there is a template re-order option in WP-admin --> Event Espresso --> Events --> Templates. The Templates screen can be used to reorder the events elements on the single event page as well as the events listing page.

<?php
//* Do NOT include the opening php tag

add_filter ('the_content', 'my_remove_event_datetimes', 100 );
 
// remove datetimes
function my_remove_event_datetimes( $content ) {
    if ( 'espresso_events' == get_post_type() && is_singular() && !post_password_required() ) {
        remove_filter( 'the_content', array( 'EED_Event_Single', 'event_datetimes' ), 110 );
        add_filter( 'the_content', 'my_add_event_datetimes', 122);
    }
    return $content;
}
 
// add datetimes after the tickets
function my_add_event_datetimes( $content ) {
    return $content . EEH_Template::locate_template( 'content-espresso_events-datetimes.php' );
}

add_filter ('the_content', 'my_remove_event_tickets', 100 );
 
// remove tickets
function my_remove_event_tickets( $content ) {
    if ( 'espresso_events' == get_post_type() && is_singular() && !post_password_required() ) {
        remove_filter( 'the_content', array( 'EED_Event_Single', 'event_tickets' ), 120 );
        add_filter( 'the_content', 'my_add_event_tickets', 121);
    }
    return $content;
}
 
// add tickets after the content
function my_add_event_tickets( $content ) {
    return $content . EEH_Template::locate_template( 'content-espresso_events-tickets.php' );
}
@lorenzocaum
Copy link
Author

The following sample files are no longer recommended as a way to adjust the order of the event elements in Event Espresso 4. As of Event Espresso 4.8.21, there is a template re-order option in WP-admin --> Event Espresso --> Events --> Templates. The Templates screen can be used to reorder the events elements on the single event page as well as the events listing page.

Here is an alternative version:

This requires creating a template file. An SFTP or FTP client (e.g. FileZilla, Cyberduck, Transmit) will also be needed.

  1. Download this file to your computer:

http://cl.ly/code/2c0u34402f2Z

  1. Login to your site with an SFTP or FTP client. Cyberduck and FileZilla are free options. Using a Mac? Try Transmit

  2. Browse to your themes folder:

Upload the file that you downloaded in step 1 to your themes folder.

  1. Locate a page.php file and duplicate it.

  2. Rename the duplicated file to single-espresso_events.php

  3. Open the new single-espresso_events.php file for editing and look for the line that calls the content for the page. Then change it to the following and save changes:

espresso_get_template_part( 'content', 'espresso_events' );

This sets the new theme template file to retrieve the event information including the ticket selector.

@lorenzocaum
Copy link
Author

References:

https://eventespresso.com/topic/cant-access-wp-admin-after-ee-update/
https://eventespresso.com/topic/ee4-template-customization/
https://eventespresso.com/topic/how-to-move-ticket-selector-from-top-in-ee4/
https://eventespresso.com/topic/moving-text/
https://eventespresso.com/topic/split-need-help-to-figure-out-how-to-setup-this-conference/
https://eventespresso.com/topic/change-event-details-order-on-archive-page/
https://eventespresso.com/topic/change-order-of-fields-in-single-event-page/
https://eventespresso.com/topic/changing-around-the-single-event-page/
https://eventespresso.com/topic/custom-event-registration-page/
https://eventespresso.com/topic/customize-event-detail-page/
https://eventespresso.com/topic/customizing-event-pages/
https://eventespresso.com/topic/customizing-the-event-page-2/
https://eventespresso.com/topic/edit-templates-in-ee4/
https://eventespresso.com/topic/ee4-event-item-order/
https://eventespresso.com/topic/ee4-move-datetime-above-ticket-selector/
https://eventespresso.com/topic/ee4-move-event-registration-listing-date-and-time/
https://eventespresso.com/topic/ee4-need-to-customise-single-event-template/
https://eventespresso.com/topic/ee4-people-addon-how-to-move-person-to-end-of-single-content/
https://eventespresso.com/topic/event-description-before-ticket-options/
https://eventespresso.com/topic/event-page-elemtns-got-rearranged-ee4/
https://eventespresso.com/topic/event-templating/
https://eventespresso.com/topic/how-do-i-move-the-register-now-button-or-whole-block-to-bottom-of-page/
https://eventespresso.com/topic/how-to-make-small-template-customization/
https://eventespresso.com/topic/managing-mulitiple-events-on-behalf-of-clients/
https://eventespresso.com/topic/moving-elements-around-within-templates/
https://eventespresso.com/topic/moving-event-elements-within-event-page/
http://eventespresso.com/topic/move-people-to-the-bottom-of-the-event-listing-page-rather-than-the-top/
https://eventespresso.com/topic/problem-with-modified-installation/
https://eventespresso.com/topic/problems-moving-the-description-on-the-event-page-for-purchasing-tickets/
https://eventespresso.com/topic/single-event-detail-page-problems/
https://eventespresso.com/topic/social-media-problem/
https://eventespresso.com/topic/split-editing-registration-confirmation-email-message/
https://eventespresso.com/topic/where-ticket-selector-is-displayed/
https://eventespresso.com/topic/can-i-move-the-body-of-an-event-above-the-ticket-selector/

View more recommendations for Event Espresso:

http://enzo12.com/labs/event-espresso/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment