Support

Home Forums Event Espresso Premium Editing View Details Button

Editing View Details Button

Posted: September 2, 2020 at 12:06 am

Viewing 8 reply threads


KGM_Adm

September 2, 2020 at 12:06 am

Hello, I want to edit the View Details button to say ‘Register Now’ I have found the code on DisplayTicketSelector.php should I directly edit the view details bttn function here or is there a proper way to make this edit? I tried putting the file in my child theme folder like I was previously told to do when editing EE files but that did not seem to work.


Tony

  • Support Staff

September 2, 2020 at 3:15 pm

Hi there,

Do you mean this code?

$btn_text = apply_filters(
    'FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text',
    esc_html__('View Details', 'event_espresso'),
    $this->event
);

If so, notice how it’s wrapped in a filter?

apply_filters({name_of_filter}, {thing_to_filter}, {additional_objects....})

That’s how WordPress (and therefor EE) allows you to ‘hook’ in and make changes without actually modifying files. If you are not familiar with hooks I highly recommend you read this:

https://www.smashingmagazine.com/2011/10/definitive-guide-wordpress-hooks/

Without a solid understanding of hooks you asking for trouble.

To answer your question, no you don’t modify core files (and the answer to ‘should I modify X file’ is almost always no, use a hook or request one be added if there isn’t one already available).

To change that text you can use the functions provided here:

https://eventespresso.com/wiki/customize-checkout-registration-button-text/#register-now

For example:

function ee_view_details_button() {
    return 'Register Now';
}
add_filter ('FHEE__EE_Ticket_Selector__display_view_details_btn__btn_text', 'ee_view_details_button');

Will change that text to ‘Register Now’ and you can place that in a custom functions plugin, we have some documentation on creating one here:

https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/


KGM_Adm

September 3, 2020 at 12:11 am

Thanks this is exactly what I needed, also are you able to respond to my other thread here? Thanks in advance!


Tony

  • Support Staff

September 3, 2020 at 6:56 am

Hi there,

Just letting you know I have just responded to your other thread.


KGM_Adm

September 3, 2020 at 1:50 pm

Thanks! I was wondering about hooks could I get one to remove the href attribute on my event titles and thumbnails when I call the shortcode please?


Tony

  • Support Staff

September 3, 2020 at 3:48 pm

We wouldn’t add a hook for those as you would do the above directly within the templates themselves.

For the event link it’s in content-espresso_events-header.php

Then for the thumbnails content-espresso_events-thumbnail.php


KGM_Adm

September 3, 2020 at 8:50 pm

I see, I wasn’t sure if I should directly modify the files or not since you send the answer is usually no. Anyway, I will modify them for this then, thanks!


KGM_Adm

September 3, 2020 at 11:56 pm

One last question, for the view details button how can I make it open the link in a new tab? is there a hook?


Tony

  • Support Staff

September 4, 2020 at 3:43 am

I see, I wasn’t sure if I should directly modify the files or not since you send the answer is usually no. Anyway, I will modify them for this then, thanks!

Yeah my apologies, I can see how that come across confusing.

Template files (in the various forms they have) would generally be considered files in which you control the full output so we wouldn’t add hooks into those for specific changes like above (the href’s are hardcoded into the templates already).

We’d add hooks within core to make changes to a function/method, generally not within templates (and just to be clear there isn’t a hook you can do the above with).

So if you are manually generating an output and have full control over it (like you do with templates) we generally wouldn’t add a hook, if you called some method that returned X and you wanted to alter how that method worked a little we may be able to add a hook into that (we would investigate if it was viable to add one first).

One last question, for the view details button how can I make it open the link in a new tab? is there a hook?

Yes, and thats a great example of where a hook would be used. Add something like:

add_filter('FHEE__EventEspresso_modules_ticket_selector_DisplayTicketSelector__displayViewDetailsButton__url_target_blank', '__return_true');

To your site and it should open in a new window.

Viewing 8 reply threads

The support post ‘Editing View Details Button’ 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