Include the Organiser in the event list shortcode

WordPress Event Management, Calendars & Registration Forums General Question Include the Organiser in the event list shortcode

This topic contains 2 replies, has 2 voices, and was last updated by  CYCOffice 8 years, 6 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #23943

    Hello,

    We use your event organiser plugin to run a sailing clubs race program.

    We would like to generate a list of events which include the name of the event organiser, and an attribute from his membership profile (his contact information).

    Can you show me how to get the organiser attribute from the event and extend the eo_event shortcode?

    CYCOffice
    #23950

    Hi Louise,

    There are two ways of changing the output of the event list shortcode, discussed on this page: http://docs.wp-event-organiser.com/shortcodes/events-list/

    Unfortunately there are no placeholders available for details of the organiser (I can look to add this in a future release if that will be helpful). However, rather than using placeholders, you can copy the template file into your theme and edit it there.

    To get the ID of the event organiser:

    $organiser_id = get_the_author_meta( 'ID' );
    

    You can then use the default WordPress functions to retrieve data on that user ID.

    $organiser = new WP_User( $organiser_id );
    $organiser_name = $organiser->display_name;
    //first name: $organiser->first_name;
    //last name: $organiser->last_name;
    

    with regards to retrieving an attribute from his membership profile, that will depend on where that data is stored. If it is stored as user meta then you can use get_user_meta()

    Stephen Harris
    #23975

    Thanks for the help, that worked a treat!

    CYCOffice
Viewing 3 posts - 1 through 3 (of 3 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.