Using shortcodes within event descriptions

Home Forums Calendar Products Events Calendar PRO Using shortcodes within event descriptions

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #15605
    Jen
    Participant

    I have been using a custom shortcode to insert post content into the description field of some of my events. (The fewer places to update information, the better!) Anyway, the tooltips on the calendar weren’t equipped to deal with shortcodes.

    It was an easy fix, setting up a custom table.php file in my theme and changing one line from:

    TribeEvents::truncate(get_the_content())

    to

    TribeEvents::truncate(do_shortcode(get_the_content())

    I thought I’d document the fix here and request that it be added to a future update.

    #15657
    Rob
    Member

    Hi Jen. Thanks for the note here. Glad to see you got this figured out. I’m going to run it by the team and if makes sense, will integrate smoothly and is issue-free to incorporate in the code, we’ll definitely include this for a future release. Thanks for the heads up!

    #15920
    Rob
    Member

    Hi again Jen. Just wanted to confirm that I talked this over with our dev Joey today. He looked at the code for the truncate() function in our plugin and it already has:

    apply_filters(‘the_content’, $text);

    which runs through do_shortcode() – we also tested it with a shortcode and it did process and show the shortcode. So this should be working appropriately.

    #16121
    Jen
    Participant

    Yes, but the same truncate() function also includes strip_shortcodes(), which I’m getting around by putting do_shortcodes() around the_content() *before* running it through truncate().

    #16153
    Rob
    Member

    Ah, I see. That’s outside my area of expertise – let me get Joey to comment directly. Thanks Jen!

    #16234
    Joey Kudish
    Member

    Hi Jen,

    Your comment makes perfect sense actually, and it didn’t make much sense for us to strip shortcodes there anyway. I’ve just committed the removal of strip_shortcodes() in the truncate function to our development codebase, so do expect that in a future release.

    Cheers

    #17047
    Jen
    Participant

    I’m also having shortcode issues in the description portions of the functions iCalFeed() and googleCalendarLink(). The content in the former is not being run through apply_filters(), and the latter is getting encoded before apply_filters(), which prevents the shortcode from being expanded. I’ve got a workaround in place, but wanted to bring it to your attention.

    I’ve also got a separate issue with too-long URIs that I see is being handled in an upcoming release.

    #17048
    Jen
    Participant

    Sorry, I should have said apply_filters(‘the_content’,$content) in those references. Or I can also just wrap the content in do_shortcode() as before.

    #17056
    Rob
    Member

    Thanks Jen. Can you provide some steps to recreate the ical/Google Calendar shortcode issue? We can try to resolve it from there…glad you have a workaround but if there is an issue with the code we definitely want to make sure that gets fixed.

    #17068
    Jen
    Participant

    I used a custom shortcode in the description of my events, and then when I exported the calendar items via either Google or iCal, the shortcode was left intact rather than expanded. So I’d see something like “[list cat=32 current=true]” instead of “This event is fantastic and you should totally go. Here are more details and a picture.”

    In the case of iCalFeed(), the content is never filtered, so the shortcodes are never run. For googleCalendarLink(), the shortcodes are being encoded before they are filtered, which then prevents them from running.

    Once I got this fixed, I then ran into two unrelated problems with googleCalendarLink(), which I’ll relate in separate threads. (One I think you’re already on top of.)

    #17111
    Rob
    Member

    Ah, gotcha. Thanks for confirming as much – looks like this is indeed an issue with the current release. While 2.0.5 is already tagged and awaiting release, I have logged this for 2.1. Thanks for the heads up here, Jen, and apologies for the inconvenience for the time being.

    #976386
    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 12 posts - 1 through 12 (of 12 total)
  • The topic ‘Using shortcodes within event descriptions’ is closed to new replies.