Support

Home Forums Event Espresso Premium Changing Button Text From Register Now to Purchase Tickets

Changing Button Text From Register Now to Purchase Tickets

Posted: December 24, 2018 at 10:06 am

Viewing 6 reply threads


fallenofficer

December 24, 2018 at 10:06 am

Hello,
I followed this thread https://eventespresso.com/topic/change-button-text/

Added a new plugin called buttontext and inside there I placed the functions.php file. I checked the permissions and they are RW—R like my other plugins but it is not working.


Josh

  • Support Staff

December 26, 2018 at 8:30 am

Hi,

May I ask did the plugin get activated on the WP > Plugins page? If it’s activated, can you post a copy of the code into a pastebin or GitHub Gist, then link to that code here?


fallenofficer

December 26, 2018 at 7:58 pm

It is not showing up in my plugins in the wordpress console

code i used is:
`<?php //Please do not include the opening PHP tag if you already have one.

//Another example that uses a custom field within the event.
//Set ee_purchase_tickets to true within your event to display ‘Purchase Tickets’
//If no value has been set default to the standard button text (Register Now).

function tw_ee_custom_filter_ticket_selector_submit_button_text( $btn_text, $event ) {

$purchase_tickets = $event->get_post_meta( ‘ee_purchase_tickets’, true );

if ( $purchase_tickets ) {
$btn_text = __( ‘Purchase Tickets’, ‘event_espresso’ );
}

return $btn_text;
}
add_filter( ‘FHEE__EE_Ticket_Selector__display_ticket_selector_submit__btn_text’, ‘tw_ee_custom_filter_ticket_selector_submit_button_text’, 10, 2 );


Josh

  • Support Staff

December 27, 2018 at 8:14 am

OK, so the reason you’re not seeing the plugin in WP > Plugins is because you did not follow this guide:

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

What you’ll need to do is follow that guide, then put your code into the plugin you’ve created. Then you activate the plugin.


fallenofficer

December 27, 2018 at 6:33 pm

I did follow the instructions. See screenshots
http://jlhweb.com/rambo/shot1.jpg
http://jlhweb.com/rambo/shots2.jpg


Tony

  • Support Staff

December 28, 2018 at 3:32 am

Ok, I wrote that function so first let’s clarify how that specific function works.

This line:

$purchase_tickets = $event->get_post_meta( ‘ee_purchase_tickets’, true );

Is looking for a custom field on the event called ‘ee_purchase_tickets’ and will only change the text if that has been set, why? Because when I wrote that function it was requested to be applied only to specific events.

So that function as you have it now, only works if you have something like this in the event – http://take.ms/XihBF

If you are looking to change ‘Register Now’ to ‘Purchase Tickets’ on all events automatically you use the first function.php file in the Gist:

https://gist.github.com/Pebblo/6ca533539b2ed37ed88801825fdd2f2f#file-functions-php

Notice how the first file doesn’t have the line I mentioned? It just changes the text on all events.


Josh

  • Support Staff

December 28, 2018 at 8:34 am

Your plugin is also missing the plugin header, so WordPress will not recognize that it’s a plugin. That’s step 5 in the instructions for setting up a custom plugin.

What you’ll need to do is right after the opening PHP add this:

/*
Plugin Name: Site plugin for my site
Description: This is where I put my custom code
*/

Then, after you save the file, you can refresh the WP > Plugins page and you’ll see the plugin and be able to activate it.

Viewing 6 reply threads

The support post ‘Changing Button Text From Register Now to Purchase Tickets’ 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