Hot to replace "Recurring Event" with text in Tooltip?

Home Forums Calendar Products Events Calendar PRO Hot to replace "Recurring Event" with text in Tooltip?

Viewing 10 posts - 1 through 10 (of 10 total)
  • Author
    Posts
  • #903227
    Glenn
    Participant

    Hi,

    I have an event that shows as: 01/12/2014 @ 9:00 am – 5:00 pm
    |Recurring Event (See all)

    I think it would be better if it displayed as: 01/12/2014 @ 9:00 am – 5:00 pm
    | Every day until Jan 3, 2015

    Which is the text in the tooltip displayed when you hover over the “Recurring Event” text.

    What changes need to be made to achieve this?

    Thanks.

    Glenn.

    PS – hope you enjoyed your few days off! 🙂

    #903384
    Brook
    Participant

    Howdy glennpackham,

    That is a cool idea. I am surprised I have not seen anyone else think of it before.

    The function to get that string of text “Every day until Jan 3, 2015” is tribe_get_recurrence_text(). Just echo that. But, where do you put it? That is a good question! And without more information I am afraid I can not answer. That string of text appears in the widgets on our site, tooltips, and I believe a few other places as well. Do you have a link or screenshot to the page that you wanted to change it on?

    I had an awesome holiday! I hope you did too. It is good to kick back every now and again.

    – Brook

    #903397
    Glenn
    Participant

    Feel free to call me Glenn (I have a feeling I will be here for a while!) 🙂

    I thought of it because I am brilliant (Just ask me!).

    http://onin.melbourne/ In the area of upcoming events – wherever a reoccurring event is happening.

    Also in the event screen – I think it would look better, As per link below.
    http://onin.melbourne/event/the-fashion-world-of-jean-paul-gaultier/2014-12-01/

    Problem with having days off is the work keeps on piling up! 🙂

    Regards,

    Glenn.

    #905625
    Brook
    Participant

    Ahh, well that probably makes it easier. All of those strings are powered by one function, tribe_events_recurrence_tooltip(). And it just so happens that the entire output of that function is run through this filter: ‘tribe_events_recurrence_tooltip’. So, you could basically just copy/paste the code form that function into your theme’s funcitons.php, rename it, remove the filter at the end, and then attach that filter to ‘tribe_events_recurrence_tooltip’. Now your function.php is the one outputting the text. Change the ‘Recurring Event’ text to tribe_get_recurrence_text() and you should be good!

    It’s been a pleasure helping you, Glenn. Please let me know if that does what you wanted, or if you have any other questions. Thanks!

    – Brook

    #930392
    Anna
    Participant

    Hi

    I am trying to do the same thing, and need a bit more explanation, the bit where you say “remove the filter at the end, and then attach that filter” can you spell that out a bit more please?

    Do you mean add a line starting remove_filter to the new function? Or take out the code regarding filters from the copied function? ALso the link to that function doesnt work, so I copied it from the plugin code, not sure if that is the same though.

    Any help appreciated, thanks

    #930614
    Brook
    Participant

    Good questions.

    When I said remove the filter at the end, I meant remove the line “apply_filter(‘tribe_events_recurrence_tooltip’…” If you don’t remove it then you will have created an infinite loop, where at the end of the function it calls the filter which calls your new function and continues until the server timesout. So once you have:

    1. copied tribe_events_recurrence_tooltip()
    2. paste it in functions.php
    3. renamed the new function you just pasted
    4. removed the apply_filter line
    5. now you can attach that new function to the WP Filter ‘tribe_events_recurrence_tooltip’ with add_filter().

    Does that clear it up, Anna?

    – Brook

    #930667
    Glenn
    Participant

    Hey – Happy 2015!

    I didn’t implement this due to being a newbie and most of what you said went over my head… I have messed with a few filters – but they were quite basic (I successfully removed “Upcoming Events” from the title for example that I’ll include below in case it helps someone.)

    /**
     * Filter Single Event Title in the Events Calendar 3.8 to Remove Upcoming Events
     * 
     */
    add_filter('tribe_events_title_tag', 'ecp_filter_single_title', 10, 4);
    function ecp_filter_single_title( $title_filter, $new_title, $title, $sep ) {
    		if( tribe_is_event() && is_single() ) {
    			$title_filter = str_replace('Upcoming Events |', '', $title_filter);
    		}
            return $title_filter;
    }

    Even now I worry about making changes that might be undone by updates.

    But – I think spending some time explaining what the filter does and maybe making a tutorial on the subject would help those who are still getting a feel for how it all works. Maybe this would be a perfect example for the tutorial! 🙂

    Regards,

    Glenn.

    #931582
    Brook
    Participant

    Thanks for the feedback, Glen.

    To clarify, if done properly all of the instructions above should not be undone when you update. That snippet you linked for changing upcoming events should be put inside of a functions.php file. If you are updating your theme form time to time within WP’ update area, then you would want to apply changes to a Child Theme. Now I 100% agree with you that this requires a lot of know how on the part of the person modifying. But, it is unfortunately necessary that when modifying a program like WP you know a little programming.

    I appreciate the advice on making this a tutorial. I will make sure it is kept in mind for one. Up until now I have only seen a couple of people request it though. And we do have to weigh user demand/popularity into the equation. Perhaps this snippet will do for now to tide us over until a possible tutorial:

    [php]
    function tribe_events_recurrence_tooltip_renamer( $tooltip ) {

    if ( empty( $post_id ) ) {
    $post_id = get_the_ID();
    }
    $tooltip = ”;
    if ( tribe_is_recurring_event( $post_id ) ) {
    $tooltip .= ‘<div class="recurringinfo">’;
    $tooltip .= ‘<div class="event-is-recurring">’;
    $tooltip .= ‘<span class="tribe-events-divider">|</span>’;
    $tooltip .=’My Custom Text’;
    $tooltip .= sprintf(‘ <a href="%s">%s</a>’,
    tribe_all_occurences_link( $post_id, false ),
    __( ‘(See all)’, ‘tribe-events-calendar-pro’ )
    );
    $tooltip .= ‘<div id="tribe-events-tooltip-‘. $post_id .’" class="tribe-events-tooltip recurring-info-tooltip">’;
    $tooltip .= ‘<div class="tribe-events-event-body">’;
    $tooltip .= tribe_get_recurrence_text( $post_id );
    $tooltip .= ‘</div>’;
    $tooltip .= ‘<span class="tribe-events-arrow"></span>’;
    $tooltip .= ‘</div>’;
    $tooltip .= ‘</div>’;
    $tooltip .= ‘</div>’;
    }

    return $tooltip;
    }
    add_filter( ‘tribe_events_recurrence_tooltip’, ‘tribe_events_recurrence_tooltip_renamer’ );
    [/php]

    That should be the code you need. Just Change My Custom Text to whatever. Paste that in a child theme’s functions.php, or even the parent them if you don’t plant to update said theme anytime soon.

    Did that work? Thanks again guys.

    – Brook

    • This reply was modified 11 years, 3 months ago by Brook. Reason: Removed auto inserted tag
    • This reply was modified 11 years, 3 months ago by Brook.
    #939614
    terrizsolo
    Participant

    Brilliant, just what I was looking for! (to be able to display the tooltip text elsewhere.)

    Thanks!

    #939636
    Brook
    Participant

    I am happy to hear that terrizsolo! I’ll chalk that up as another request for a tutorial. 🙂

    I am going to archive this topic Glenn, since it has been a couple weeks without a response. That’s when we basically assume that the issue is resolved. If however that’s a mistake, please open a new topic. We want to help you!

    Cheers!

    – Brook

Viewing 10 posts - 1 through 10 (of 10 total)
  • The topic ‘Hot to replace "Recurring Event" with text in Tooltip?’ is closed to new replies.