Re-naming Buy Now to Book Now on Events Calendar List plus changing the link
-
HI,
I have two questions
1) How do I change the wording from “Buy Now” to “Book Now” on the listed Events page. Which template is this on and is it possible?
2) Instead of the Buy Now (Book Now) link going to the ticket section of the Event itself, where do I change the link so that it just goes to the page instead of the section?
Hey Stephen, thanks for getting in touch!
If you use WooCommerce to sell tickets, then you can either use the plugin Say What? to change the string:
- Original string: Buy Now!
- context: list view buy now ticket button
- namespace: event-tickets
- replacement string: Book Now!
Or you can hook into this filter:
apply_filters( 'tribe_tickets_buy_button', $html, $parts, $types, $event_id );
The ‘$html’ here contains the full html markup for the button, so you will need to do a ‘str_replace()’ or similar to change ‘Buy Now!’.
Since you also want to change the anchor ‘#buy-tickets’ probably the filter would be the better option.
Hope this helps you get started. Let me know.
Cheers,
AndrasThanks for your reply. Ok, so I tried this following piece of code and it did not work. I added this to my child theme functions.php file
add_filter( ‘tribe_tickets_buy_button’, ‘changes_button_text’, 11, 2 );
function changes_button_text( $html ) {
$html = str_replace(“Buy Now”, “Book Now”, $html);
return $html;
}I also haven’t figured out within this above code how to ensure that the button doesn’t go to the #buytickets anchor that is set by Tribe and only goes to the page itself.
Could you assist with both?
Many thanks
Correct AnswerHey Stephen,
That’s a very good start! I used your code and it worked for me. Just make sure that you use straight quotes (“) and (‘) and not curly ones (“) and (‘)
Here is my final code for also not making it jump to the tickets.
add_filter( 'tribe_tickets_buy_button', 'changes_button_text', 10, 2 ); function changes_button_text( $html ) { $html = str_replace("Buy Now", "Book Now", $html); $html = str_replace("#buy-tickets", "", $html); return $html; }
Hope this helps.
Cheers,
AndrasYes Andras, I have added this to the site and it has worked! Great start to the day, thanks for your help!!
Awesome, happy to hear!
I am going to close this ticket, but if you need anything else related to this topic or another please create a new ticket and we’ll be happy to help.
Cheers,
AndrasPS: We’d be grateful if you would give us feedback on your satisfaction with support. Just click on one of the classy looking emojis below. 🙂 If you can spare a few words, that’s even better. Thanks!
PS2: If you like our plugins, and you didn’t yet do so 🙂 we would also be happy to receive a review in the wordpress.org repository. Much appreciated!
https://wordpress.org/support/view/plugin-reviews/the-events-calendar/
https://wordpress.org/support/view/plugin-reviews/event-tickets/
The topic ‘Re-naming Buy Now to Book Now on Events Calendar List plus changing the link’ is closed to new replies.