Home › Forums › Calendar Products › Events Calendar PRO › Is there a way to add a shortcode to the "excerpt" section?
- This topic has 8 replies, 3 voices, and was last updated 9 years, 3 months ago by
Lisa.
-
AuthorPosts
-
January 25, 2017 at 3:37 pm #1224059
Lisa
ParticipantI’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?
January 25, 2017 at 3:52 pm #1224068George
ParticipantHi 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,
GeorgeJanuary 27, 2017 at 8:09 pm #1225539Lisa
ParticipantHi 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.
January 30, 2017 at 9:58 am #1226257George
ParticipantHey 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
January 31, 2017 at 12:49 pm #1227096Lisa
ParticipantHi 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
February 1, 2017 at 3:55 pm #1227871George
ParticipantHey 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,
GeorgeFebruary 1, 2017 at 11:08 pm #1228035Lisa
ParticipantThank 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
February 2, 2017 at 8:11 am #1228178George
ParticipantSure 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 -
AuthorPosts
- The topic ‘Is there a way to add a shortcode to the "excerpt" section?’ is closed to new replies.
