• Resolved davids40

    (@davids40)


    Hi, it seems there has been important structural changes with the last update to the plugin as I had added a custom line to strip out shortcodes showing in excerpts in the helper_posts file, in the post_excerpt function which I can’t seem to find now.

    I would like to suggest this comes as a feature of the plugin as I bet nobody wants html tags or shortcodes to be showing in post excerpts.

    In the meantime, can you guide on how to proceed with the current 2.3.0 version?

    For guidance, I was adding the following line just at the end of the If in the post_excerpt function:
    $excerpt = strip_shortcodes( $excerpt );

    Thanks in advance for your assistance.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Shazzad Hossain Khan

    (@sajib1223)

    I have added a new param strip_shortcodes on the [post_excerpt] shortcode. Use it like this – [post_excerpt strip_shortcodes="1"]

    Thread Starter davids40

    (@davids40)

    Just tried it, and unfortunately adding the strip_shortcodes option does not change the visible outcome, it does not seem to work in my case and is leaving the shortcodes from our wpbakery editor.

    I’ve also noticed the last update introduced an issue in the generated code with some tag closures (image calling the post_thumbnail in src mode) now showing on the page rather than being properly interpreted.

    this is the code i’m using now with the addition of the strip_shortcodes option:

    <ul>
    [posts]
    <li class="w4-post-content">
    <time class="w4-post-time" datetime="[post_date format="Y-m-d H:i:s"]">[post_date format="j F Y"]</time>
    <a class="post-thumb" href="[post_permalink]" rel="bookmark"><img alt="[post_title]" loading="lazy" src="[post_thumbnail width="60" return="src"]" /></a><h3>[title]</h3>
    <div style="clear:both;"></div>
    [post_excerpt strip_shortcodes="1" wordlimit="25"]
    </li>
    [/posts]
    <li class="w4-more-posts"><a href="/fr/blog/"><span>Plus d'</span>Articles</a></li>
    </ul>
    • This reply was modified 3 years, 11 months ago by davids40.
    Plugin Author Shazzad Hossain Khan

    (@sajib1223)

    I had release an update. strip_shortcodes should be working fine now. As well as post_thumbnail should also be fixed. For future, use output parameter rather than return. Right now return will work as fallback.

    Thread Starter davids40

    (@davids40)

    I’ve just updated to version 2.3.2 and changed the option to output for the post_thumbnail as advised.

    No more tag closures indeed, however, the post excerpt for the post that had shortcodes is not showing at all. Is it the expected behavior?

    My list has only 3 items, the 2 first posts do not have shortcodes and are showing normally. Only the 3rd is not showing.

    Plugin Author Shazzad Hossain Khan

    (@sajib1223)

    Hi,
    I couldn’t reproduce the issue. Could you provide some reference, screenshots ?

    It looks that strip-shortcodes removes also internal content so if the content of a post is built in the page builder then no content is returned at all:

    for example content without stripe is like that:
    [awesome_page_bilder_post]
    [awesome_pagebilder_bold_text]Look at this![/awesome_pagebilder_bold_text]
    There is more text to this post here!
    [/awesome_page_bilder_post]

    then turning strip-shortcodes on removes not only shortcodes but whole text inside them. It returns an empty string when expected behavior should be like this:
    Look at this! There is more text to this post here!

    • This reply was modified 3 years, 6 months ago by anghorpl.
Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Stripping shortcodes’ is closed to new replies.