Tooltip calendar showing excerpt

This topic contains 4 replies, has 2 voices, and was last updated by  Siger Smit 10 years ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #15416

    Hi,
    What do I have to do to let the tooltip on te full calendar show the excerpt from an event?
    Thanks!

    Siger Smit
    #15462

    Hi Siger,

    The plug-in by default uses an excerpt of the event content. To use the user-entered excerpt (or more generally to change the description), you can use the hook eventorganiser_event_tooltip (see codex for an example).

    Please note that the calendar is cached. You’ll need to clear the cache (e.g. update an event) before changes will take effect.

    Given the event ID you can get the user-entered excerpt like so:

    $post = get_post( $event_id );
    $excerpt = $post->post_excerpt;
    
    Stephen Harris
    #15549

    Hi Stephen,

    Thanks, this works, but it seams that te full calendar takes a lot more time to load, for a visitor it may seem there are no events at all… I used this code:

    add_filter('eventorganiser_event_tooltip', 'my_event_tooltip_excerpt', 10,2);
    function my_event_tooltip_excerpt( $excerpt, $event_id, $post){
    
    $post = get_post( $event_id );
    $excerpt = $post->post_excerpt;
    
    return $excerpt;
        }
    

    Is this correct?

    Thanks, Siger

    • This reply was modified 10 years ago by  Siger Smit.
    Siger Smit
    #15567

    Nope, that 2 should be 3, it indicates the number of arguments being passed to the callback (also note the the third argument is the occurrence ID, not the post object).

    Not tested, but this should work:

    add_filter( 'eventorganiser_event_tooltip', 'my_callback_function', 10, 4 );
    function my_callback_function( $description, $event_id, $occurrence_id, $post ){
        return $post->post_excerpt;
    };
    
    • This reply was modified 10 years ago by  Stephen Harris.
    Stephen Harris
    #15579

    Thanks, it works!!

    Siger Smit
Viewing 5 posts - 1 through 5 (of 5 total)
To enable me to focus on Pro customers, only users who have a valid license for the Pro add-on may post new topics or replies in this forum. If you have a valid license, please log-in or register an account using the e-mail address you purchased the license with. If you don't you can purchase one here. Or there's always the WordPress repository forum.