Support

Home Forums Event Espresso Premium Can you add custom fields to the my events short code"

Can you add custom fields to the my events short code"

Posted: June 20, 2020 at 12:03 pm


greg@successteam1.com

June 20, 2020 at 12:03 pm

Is it possible to include custom links to the [ESPRESSO_MY_EVENTS] for virtual events.

See: https://share.vidyard.com/watch/RsGj37uPvjTEeM3LaF1Xwx?

We only show this on our members only page. This would make it really easy for members to login and get links to virtual meetings.


Tony

  • Support Staff

June 22, 2020 at 5:35 am

Hi there,

Yes, it’s possible but the way you do it differs depending on where you want to include the details.

It looks like you want to include it on the date/time section, assuming making that section a link? If so that will require you load a couple of custom templates for the my events section and modify those.

Without loading custom templates the other option is to add another ‘action’ to the actions section with your own icon.

If you let me know which you prefer I can add more details on how you go about doing either.


greg@successteam1.com

June 23, 2020 at 8:18 am

Hey sorry for the delay, forgot to tic the box to notify me. I’m open to adding custom templates. Let’s go that route


Tony

  • Support Staff

June 23, 2020 at 12:10 pm

Ok, so you want to wrap the date with the link you have set in custom fields?

I’m open to adding custom templates.

Note that by loading your own custom templates, you take responsibility of keeping those templates updated as we update the default templates.

The first template you need is:

\eea-wpuser-integration\templates\content-espresso_my_events-event_section.template.php

Grab that template and place a copy in the root directory of your theme (preferably a child theme).

The template in the root directory can now be edited as it will be used in place of the original. Around line 115 you’ll have:

$template_args = array('registration' => $registration);

Change that to:

$template_args = array('registration' => $registration, 'event' => $event);

That passes the current event to the template used to output the date. (You could pull this for each registration but this is more efficient)

Now grab \eea-wpuser-integration\templates\content-espresso_my_events-event_section_tickets.template.php

Place that in your themes root directory again.

The EE_Event object has a get_post_meta($meta_key = '', $single = true); method (its a wrapper for WP get_post_meta()) so you can pull custom fields using:

$value = $event->get_post_meta($meta_key, true);

So for example:

$zoom_url = $event->get_post_meta('zoom_url', true);

$zoom_url will be whatever the value was you set on the field.

Now just wrap line 16 with an a tag using your zoom URL as the href and your done.

You must be logged in to reply to this support post. Sign In or Register for an Account

Support forum for Event Espresso 3 and Event Espresso 4.
Documentation for EE3 and EE4
Documentation for Event Espresso 3 Documentation for Event Espresso 4

Status: publish

Updated by  Tony 2 weeks, 2 days ago ago

Topic Tags

Notifications

This topic is: not resolved
Do NOT follow this link or you will be banned from the site!