Home › Forums › Ticket Products › Event Tickets Plus › Re-naming Buy Now to Book Now on Events Calendar List plus changing the link
- This topic has 7 replies, 2 voices, and was last updated 5 years, 6 months ago by Andras.
-
AuthorPosts
-
September 19, 2018 at 2:29 am #1625075Stephen RestarickParticipant
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?
September 20, 2018 at 5:24 am #1626260AndrasKeymasterHey 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,
AndrasSeptember 26, 2018 at 10:13 am #1631296Stephen RestarickParticipantThanks 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
September 27, 2018 at 3:46 am #1631920AndrasKeymasterHey 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.
[code language=”php”]
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;
}[/code]Hope this helps.
Cheers,
AndrasSeptember 30, 2018 at 11:52 pm #1634195Stephen RestarickParticipantYes Andras, I have added this to the site and it has worked! Great start to the day, thanks for your help!!
October 1, 2018 at 2:57 am #1634273AndrasKeymasterYou’re welcome Stephen!
Is there anything else I can help you with, before we close this?
Cheers,
AndrasOctober 1, 2018 at 4:12 am #1634303Stephen RestarickParticipantNo thanks, all sorted now.
October 2, 2018 at 1:40 am #1635161AndrasKeymasterAwesome, 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/ -
AuthorPosts
- The topic ‘Re-naming Buy Now to Book Now on Events Calendar List plus changing the link’ is closed to new replies.