Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #333210
    alexandregaeta
    Participant

    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…

    #333215
    sujapati
    Keymaster

    Hello 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
    Sujapati

     

     

     

    #333228
    alexandregaeta
    Participant

    thanks, but it didn´t work.

    #333634
    sujapati
    Keymaster

    @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.

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘Shortcode at excerpt’ is closed to new replies.