Help Desk

Re-naming Buy Now to Book Now on Events Calendar List plus changing the link

  • Posts: 4 Topics: 4
    | Permalink

    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?

    Posts: 6978 Topics: 2
    | Permalink

    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,
    Andras

    Posts: 4 Topics: 4
    | Permalink

    Thanks 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

    Posts: 6978 Topics: 2
    | Permalink
    Correct Answer

    Hey 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,
    Andras

    Posts: 4 Topics: 4
    | Permalink

    Yes Andras, I have added this to the site and it has worked! Great start to the day, thanks for your help!!

    Posts: 6978 Topics: 2
    | Permalink

    You’re welcome Stephen!

    Is there anything else I can help you with, before we close this?

    Cheers,
    Andras

    Posts: 4 Topics: 4
    | Permalink

    No thanks, all sorted now.

    Posts: 6978 Topics: 2
    | Permalink

    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,
    Andras

    PS: 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/

     

    | Permalink

The topic ‘Re-naming Buy Now to Book Now on Events Calendar List plus changing the link’ is closed to new replies.