How to add # of available tickets to event title?

Home Forums Ticket Products Event Tickets Plus How to add # of available tickets to event title?

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #1049144
    Brian
    Participant

    I’m trying to put the number of available event tickets into the title of my list & single event theme though I’m a bit uncertain as to what line of code I should place to show the available ticket #’s.

    Any help is appreciated.

    #1049153
    George
    Participant

    Hey Brian,

    Custom coding is unfortunately not something we can help with 🙁

    However, I would recommend simply diving into the plugin code for Event Ticket Plus itself and look for where the plugin itself shows the ticket count for a given event. If you then basically just “steal” this code, and copy and paste it into your own theme or a custom plugin, it should work well.

    To be a tad more specific, what you could do with that code is apply it to the “the_title” filter within WordPress, which you can read about here: https://codex.wordpress.org/Function_Reference/the_title

    That filter will apply the code to the titles of all events. So, something like this for example:

    if ( function_exists( 'tribe_get_events' ) ) {

    add_filter( 'the_title', 'tribe_support_1049144' );

    function tribe_support_1049144( $title ) {

    // Just return the normal title if this is not an event.
    if ( ! tribe_is_event() ) {
    return $title;
    }

    // Here would be the code for retrieving ticket count etc.

    return $title;
    }
    }

    Are you confident enough in your coding abilities to take things from here? Let me know. We cannot help with customizations but I will try to make the time to assist more specifically if possible and/or if needed.

    Sincerely,
    George

    #1076422
    Support Droid
    Keymaster

    This topic has not been active for quite some time and will now be closed.

    If you still need assistance please simply open a new topic (linking to this one if necessary)
    and one of the team will be only too happy to help.

Viewing 3 posts - 1 through 3 (of 3 total)
  • The topic ‘How to add # of available tickets to event title?’ is closed to new replies.