Is there a way to add a shortcode to the "excerpt" section?

Home Forums Calendar Products Events Calendar PRO Is there a way to add a shortcode to the "excerpt" section?

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1224059
    Lisa
    Participant

    I’d like to be able to insert social share buttons so that when hovering over the event on the calendar, they can access the button(s) from there. I tried <?php echo do_shortcode(“[shortcode]”); ?> but I may not have been doing it right (it didn’t work, in any case).

    Is it possible to do this?

    #1224068
    George
    Participant

    Hi Lisa,

    WordPress does not allow shortcodes in the Excerpts by default. It will not process them as shortcodes. To modify this behavior, you would have to add code like the following to your theme’s functions.php file:


    add_filter( 'the_excerpt', 'do_shortcode' );

    From there, you should be able to add normal shortcodes in your excerpts—so, for example, you would just add [shortcode] to the excerpts, NOT something like <?php echo do_shortcode(“[shortcode]”); ?>

    Cheers,
    George

    #1225539
    Lisa
    Participant

    Hi George,

    Thanks for the reply! That didn’t work. Is there another way I might be able to get it to work so it shows up on the calendar on hover? What they want is for a Twitter share button to be available when people hover over the event, rather than having to go to the page to access it.

    #1226257
    George
    Participant

    Hey Lisa,

    Thanks for elaborating a bit on your goals—pulling of what you describe is unfortunately a bit trickier to do and is not possible without some extensive custom coding. 🙁

    The level of coding required is beyond the scope of customer support we can provide, per the notes on this page → https://theeventscalendar.com/knowledgebase/what-support-is-provided-for-license-holders/

    I will attempt to pull this off with a bit of custom code nonetheless, though—sit tight, it may take me some time to come up with something and I may fail outright to do so, but I will try!

    — George

    #1227096
    Lisa
    Participant

    Hi George,

    Hey, thanks…I thought it might be outside the support parameters, but I was hoping for a (relatively) easy fix! No problem if it’s a pain, I’ll just let them know they need to access the share buttons by going to the event. Thank you so much for helping!

    Lisa

    #1227871
    George
    Participant

    Hey Lisa,

    Sure thing, thanks for your understanding here. I tried to make this work—it might be possible by way of some custom templating and such, using the methods described in our Themer’s Guide.

    But I was not able to get something working after some time spent trying to make it work. 🙁

    Based on your comments here I will hand the reins on this back to you—I hope the workaround of having folks accessing the “singe event” views works well for now.

    Please let me know if there are any other issues or questions I can try to help with.

    Sincerely,
    George

    #1228035
    Lisa
    Participant

    Thank you so much for trying, George! Maybe I’ll take it on as a learning project at some point 🙂 In the meantime, I think they’ll be fine with clicking through to the event.

    Thanks again,

    Lisa

    #1228178
    George
    Participant

    Sure thing, Lisa. Thanks for your patience here.

    I’ll close this thread for now, but please feel free to open a new thread any time if other issues or questions arise.

    Sincerely,
    George

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Is there a way to add a shortcode to the "excerpt" section?’ is closed to new replies.