WordPress.org

Ready to get started?Download WordPress

Forums

Network Latest Posts
[resolved] Feed does not remove [] sortcodes (7 posts)

  1. Aircut
    Member
    Posted 1 year ago #

    hello. i am having fun trying to get the plugin work correctly,
    it seems that in the post excerpt, shortcodes from other plugins are coming as raw text - that what i get

    Title

    My Blog - Published on September 24, 2012 by author
    [vc_gallery title="fruits:" type="flexslider_fade" interval="3" ...more

    is there a way to tell the script to use only post content and ignore short codes in the output?

    http://wordpress.org/extend/plugins/network-latest-posts/

  2. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Hi,

    Are you using version 3.1.5 of Network Latest Posts? If so, is that "vc_gallery" plugin active?

    If you're using the latest version it shouldn't be displaying those tags unless that gallery plugin isn't being registered as a shortcode or tag and WordPress don't recognize it as such, or it's being escaped.

    I just tested with my own plugin, here you can see the post: Testing Excerpt Strips

    [nlposts title='Testing Excerpt Strips' title_only=false] Hi, this is the content, when extracting excerpts the shortcode inserted before this line should be stripped, this is a proof NLPosts is working as expected.

    And here under number 1 the results: Displaying Excerpts

    TESTING EXCERPT STRIPS
    Hi, this is the content, when extracting excerpts the shortcode inserted before this line should be stripped, this is a proof NLPosts is working as ...more

    Finally, if you are displaying the vc_gallery shortcode as an example of usage like this: [[vg_gallery title="fruits:" type="flexslider_fade" interval="3"]] it WON'T be stripped, this is because double square brackets are used to escape shortcodes and WordPress will recognize that line as a text string.

  3. Aircut
    Member
    Posted 1 year ago #

    Thank you Jose for getting back to me, the shortcodes that are being unfiltered are from another plugin "Visual Composer for WordPress"
    http://demo.wpbakery.com/vc/
    all its shortscods are being ignored.... and way around it?

  4. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Hi, I'm going to do some tests to see what's happening with that plugin. As soon as I find a solution I'll post it here.

  5. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Just to keep you up to date, I confirm those tags are not being stripped away. I'm working on a fix for this. I've changed the status of this topic to non resolved until I come up with a fix.

  6. Jose Luis SAYAGO
    Member
    Plugin Author

    Posted 1 year ago #

    Ok, it's fixed, or I think so, I've just uploaded the new version, it will be available in a minute or so. Apparently there exists an issue between Visual Composer and strip_shortcodes WordPress hook which makes imposible to strip shortcodes generated by this plugin.

    I solved the issue replacing the strip_shortcodes hook by a regex, if someone looks for a similar solution, here's what I did:

    I was stripping shortcodes and tags using this line:

    $content = strip_tags(strip_shortcodes($content));

    Which works for almost every kind of shortcode and tag I can imagine, but for some reason it didn't work with Visual Composer shortcodes, so I replaced that line by these two:

    $content = preg_replace("/\[(.*?)\]/i", '', $content);
    $content = strip_tags($content);

    And that's it, the first line removes everything between square brackets (shortcodes) and the second one strip tags.

    I'm marking this topic as resolved, feel free to change it if v3.1.6 doesn't solve your issue.

    Cheers.

  7. Aircut
    Member
    Posted 1 year ago #

    wow that was fast!!! you are amazing! thank you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.