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

Home Forums Ticket Products Event Tickets Plus Re-naming Buy Now to Book Now on Events Calendar List plus changing the link

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1625075
    Stephen Restarick
    Participant

    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?

    #1626260
    Andras
    Keymaster

    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

    #1631296
    Stephen Restarick
    Participant

    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

    #1631920
    Andras
    Keymaster

    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.

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

    #1634195
    Stephen Restarick
    Participant

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

    #1634273
    Andras
    Keymaster

    You’re welcome Stephen!

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

    Cheers,
    Andras

    #1634303
    Stephen Restarick
    Participant

    No thanks, all sorted now.

    #1635161
    Andras
    Keymaster

    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/

     

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Re-naming Buy Now to Book Now on Events Calendar List plus changing the link’ is closed to new replies.