• Resolved Bam Bam

    (@bam-bam)


    Hi,

    This probably isn’t really a plugin problem but I have searched high and low and can’t find an answer that works.

    I would like to add a shortcode to the post excerpts in Twenty Seventeen, I found the code below that will supposedly allow it to work, but it doesn’t.

    add_filter( 'the_excerpt', 'shortcode_unautop');
    add_filter( 'the_excerpt', 'do_shortcode');

    I also found this on Stack Exchange, but I’m not sure how to modify it to suit or if it would even solve the problem.

    function drcap ($atts, $content = null) {
        return '<div class="dropcap">' . do_shortcode($content) . '</div>';
        }
        add_shortcode('dropcap', 'drcap');

    This is the shortcode I am trying to get to display properly.

    [ujicountdown id="Days Until ICO Closes" expire="2018/02/27 00:00" hide="true" url="" subscr="Bankera ICO" recurring="" rectype="second" repeats=""]

    I would be eternally grateful for any help with this, I have yet to get my head around php.

    Kindest Regards
    Bam Bam

    • This topic was modified 7 years, 1 month ago by Bam Bam.
    • This topic was modified 7 years, 1 month ago by Bam Bam.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author RadiusTheme

    (@techlabpro1)

    Hello,

    Don’t use any Excerpt limit keep the limit field empty. If you do not set the excerpt limit then the excerpt will behave as default, then you can add any king of filtering with the excerpt as default WordPress functionality.

    Thanks

    Thread Starter Bam Bam

    (@bam-bam)

    Hi,

    Thanks for the prompt reply, the Excerpt limit is completely blank, I never set a limit in it.

    While I was waiting I did a little more hunting around and found something else I added to the functions file (last line below) which stopped it from displaying the actual shortcode, but the Countdown Timer it should be displaying still doesn’t show up, just a blank space where it should be.

    add_filter( 'the_excerpt', 'shortcode_unautop');
    add_filter( 'the_excerpt', 'do_shortcode');
    add_filter( 'get_the_excerpt', 'do_shortcode', 5 );

    I’m not sure what the 5 in that last line is there for ??

    Any other suggestions ??

    Kindest Regards
    Bam Bam

    Plugin Author RadiusTheme

    (@techlabpro1)

    Hello,

    Here 5 is the filter priority which will be execute at number 5. We are using “get_the_excerpt” to display excerpt , so you should add all filter with “get_the_excerpt” except “the_excerpt”.

    add_filter( 'get_the_excerpt', 'shortcode_unautop');
    add_filter( 'get_the_excerpt', 'do_shortcode');
    add_filter( 'get_the_excerpt', 'do_shortcode', 5 );

    Thanks

    Thread Starter Bam Bam

    (@bam-bam)

    Thanks again for the reply, as I said earlier I have no idea about php, are you saying to add “get_the_excerpt” except “the_excerpt” ??

    If so just how is that expressed exactly, sorry about the hassle.

    Bam Bam

    Plugin Author RadiusTheme

    (@techlabpro1)

    Yes use “get_the_excerpt”

    Sir you need PHP knowledge or ask your developer.

    Thanks

    Plugin Author RadiusTheme

    (@techlabpro1)

    Hello,

    I am making this topic as “resolved” if need any more help please let me know.

    Thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Use shortcodes in Excerpts’ is closed to new replies.