- This topic has 3 replies, 2 voices, and was last updated 1 month, 2 weeks ago by sujapati.
-
AuthorPosts
-
February 23, 2024 at 12:19 am #333210alexandregaetaParticipant
Hi,
I need to show a small shortcode plugin that I´ve developed that calculates time-remaining to an event.
But it is not showing at excerpt, but ok at the post.
Is there any filter removing it? Is so, what can I change to solve this issue? (i´m using child theme to do this).
Initial text…[regressiva data=”dd/mm/yyyy hh:mm”] more text, bla bla bla, readmore tag, more tag, etc…
February 23, 2024 at 1:56 am #333215sujapatiKeymasterHello Alexandregaeta,
If your shortcode is not working in excerpts, it might be due to the fact that WordPress, by default, doesn’t execute shortcodes in excerpts. You can enable shortcode execution in excerpts by adding a filter to your theme’s functions.php file.
Here’s an example of how you can enable shortcode execution in excerpts:// Enable shortcodes in excerpts function enable_shortcodes_in_excerpt() { add_filter('the_excerpt', 'do_shortcode'); } add_action('init', 'enable_shortcodes_in_excerpt');
You can add this code to your child theme’s functions.php file. This code adds a filter to the excerpt, applying the do_shortcode function, which allows shortcodes to be executed in the excerpt.
Please be cautious when adding code to your theme’s files, and ensure you have a backup before making changes.Thanks
SujapatiFebruary 23, 2024 at 8:47 am #333228alexandregaetaParticipantthanks, but it didn´t work.
March 11, 2024 at 1:35 am #333634sujapatiKeymaster@alexandregaeta: Sorry for the inconvenience. Please kindly provide the exact shortcode name and code you want to implement in your theme so I can provide you with the required code.
- This reply was modified 1 month, 2 weeks ago by sujapati.
-
AuthorPosts
- You must be logged in to reply to this topic.