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

Viewing 12 reply threads


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.


greg@successteam1.com

July 13, 2020 at 2:01 pm

OK almost have it. The last part about the “EE_Event object” the file I’m updating is the file “content-espresso_my_events-event_section.template.php” located in the theme directory? Or I’am I updating the file in the plugin directory?


Tony

  • Support Staff

July 13, 2020 at 4:35 pm

Or I’am I updating the file in the plugin directory?

The answer to that question is almost always no, if you edit core files the modification ill be lost each and every time the plugin (or theme if your modifying a theme and not using a custom/child theme).

The last part about the “EE_Event object” the file I’m updating is the file “content-espresso_my_events-event_section.template.php” located in the theme directory?

Your copy the template into your themes root directory so that file is used in place of the default one, so you are editing the version in your theme’s root directory.


greg@successteam1.com

August 13, 2020 at 7:38 am

Hey I’ve worked on this but could not get it to work… Can I hire you to set this up on our account. If so what is the cost. Thank you in advance for your help.


Tony

  • Support Staff

August 13, 2020 at 9:29 am

To clarify what you need, is it basically the steps posted here?

https://eventespresso.com/topic/can-you-add-custom-fields-to-the-my-events-short-code/#post-313394

If so we could likely create the template for you for a support token:

https://eventespresso.com/product/premium-support-token/


greg@successteam1.com

August 13, 2020 at 12:04 pm

This reply has been marked as private.


Tony

  • Support Staff

August 14, 2020 at 5:15 am

Can what I’m asking be done in 30 min?

I don’t know because it’s not really clear what you need us to do yet.

Can THIS be done within 30mins? Yes, I can make the templates pass the registration object through and pull a custom meta value in that timeframe. But without getting in to see the code and any changes made I don’t know what needs to be done.

What will I have to do with the template? Will it be installed for me?

If you provide FTP details then yes the template can be installed, I’m assuming you already have a child theme?


greg@successteam1.com

August 14, 2020 at 5:28 am

This reply has been marked as private.


greg@successteam1.com

August 14, 2020 at 6:35 am

This reply has been marked as private.


Tony

  • Support Staff

August 14, 2020 at 7:13 am

Yeah, we can do that.

To redeem your support token go you your account page on the right is a redeem support token link, click that and provide the details request

Viewing 12 reply threads

The support post ‘Can you add custom fields to the my events short code"’ 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