Posted: October 30, 2016 at 1:02 pm
|
I would like to change the button text that says “Register Now” to “Purchase Tickets”. If I am going to make changes to a code snippet – where do I add that? Thank you! |
Hi there, You will need to add a custom snippet of code to change this, the best place to place the code is within a custom functions plugin, you can follow the steps here to create one: https://eventespresso.com/wiki/create-site-specific-plugin-wordpress-site/ Then add this example to your custom plugin: https://gist.github.com/Pebblo/6ca533539b2ed37ed88801825fdd2f2f |
|
|
This worked beautifully – thank you! |
|
Ooops – This changed all the buttons – can it be restricted to only some buttons – I still need the Register Button to say Register Here. |
I’m sorry but I’m not sure what your mean, can you explain further? Maybe provide a link to an example of where you would like to change the text and another for where you would like to leave the text as is. |
|
|
Here is a diagram that shows what I need – https://thetheaterschool.com/button-text-example/ Thank you! |
Both of those sections are just the EE ‘Ticket Selector’ but you are using each section for a different purpose. The filter I provided changes the text for all instances of the ticket selector as it’s a filter to alter the text and is not currently ‘context aware’, meaning the filter doesn’t know the difference between an event that should output ‘Register Now’ and ‘Purchase Tickets’. In order to do what you need you’ll need some custom development so that the function know which events need to display what text, are you currently working with a developer? |
|
|
I am the developer – but I am new to WordPress and haven’t mastered all the ins and outs yet, but I can follow directions pretty well! |
One approach to a solution would be to use a custom field set within the event editor to change the button text. To make this as simple as possible, I should ask, will the majority of events need a button that says “Purchase Tickets” or a button that says “Register Here”? |
|
|
Register Here will be used the most |
|
What do I use for the URL to tie it in with a different button and how would I keep the wrong button from displaying? |
So what you need is a function that defaults to the normal button text (Register now) but to check for a custom field within the event and if set use ‘Purchase Tickets’. Take another look at the gist I provided, I’ve added another example: https://gist.github.com/Pebblo/6ca533539b2ed37ed88801825fdd2f2f/ The second function checks for a custom field called ‘ee_purchase_tickets’ that you can set within the event itself – http://take.ms/Bg1tw (Note you will need to create that field, its not added by default) |
|
|
Okay – I created the new custom field = ee_purchase_tickets and a functions2 php file which I added to my site Exact Code: //Another example that uses a custom field within the event. $purchase_tickets = $event->get_post_meta( ‘ee_purchase_tickets’, true ); if ( $purchase_tickets ) { return $btn_text; —– Is there another step? I added the new custom field to all of the events. I dont see any changes. https://thetheaterschool.com/rj-one-page/#register |
The above should work fine, I tested it locally and didn’t run into any issues.
You only add ee_purchase_tickets to the events that should display ‘Purchase tickets’, have you add that field to the other events? If so that tells the function to display ‘Purchase Tickets’ on all events… Also, did you remove the previous function? The first function completely override all events to display ‘Purchase Tickets’ you don’t want that, you could have used the new function in place of the original one I provided and not created a ‘functions2’ file (although I’m not really sure what you mean by that). |
|
|
Okay – I removed the custom field from the registration events and it is only on the ticket events. I returned functions.php file to the original backup file I had – thus removing the code you gave me. Unfortunately still not working – now both buttons say Register Now. Should I buy a token and will you be able to follow through to help with this? |
If you buy a support token someone from support staff can get that custom field set up. Please be sure to include FTP credentials when you fill out the redeem a support token form. |
|
|
I purchased a token – everything can be accessed through the backend of the Avada theme – will they still need ftp creds? |
Yes we will need FTP creds because we’ll be adding a functions plugin. |
|
We received the FTP credentials but I’m afraid that they’re not allowing my FTP client to authenticate. Can you double-check, then resend, and if there’s a Port number we should specify can you include that? Thanks. |
|
|
I just resubmitted the credentials – port is 21 |
Hi there, I have fixed the above so it is working on your site and responded to your support token via email. |
|
The support post ‘Change Button Text’ 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.