Support » Plugin: WordPress Popular Posts » [Plugin: WordPress Popular Posts] [Plugin: WordPress Popular Post] How prevent specific code to appe

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hi Martin,

    For that, it is necessary to hack the excerpt method built-in in my plugin to remove these links before returning the text. Will look into this and come back with a patch so you can test it.

    Thanks so much Ikki24!!!
    If I may make a suggesiton: it would be nice if there was a field in WP for the plugin where we could add codes manually that we wish to exclude from appearing. I have no idea how complicated it is to implement, so bare in mind this is only a suggestion. 🙂 Thanks again very much for looking into this!!

    Hey Martin,

    Think I got something working. Please download v2.1.5 beta here and let me know the results, alright? It should filter out all these custom Youtube links (and added other extra stuff that should be stripped out, too).

    Been thinking about yor idea and while I think it’s great, it’s also a bit difficult to implement now. Will keep it in mind, though!

    You rock Ikki24! Works like a charm. The bad youtube codes are gone. Thanks so much!

    No worries about my previous suggestion. I had a feeling it might be complicated to implement…

    That said, any idea how I could implement what you did in your plugin into “the_excerpt_rereloaded” plugin (which is what I am using on the front page for the excerpt of older posts)? The excerpt are behaving similarly, and the youtube codes do appear on the excerpt texts… So far no answer from the author of that plugin. I figured since you just tackled this subject, perhaps you`d have a quick fix for that plugin too?

    Thanks a bunch!

    I believe this should do it:

    Open the_excerpt_rereloaded.php and change this code (around line 58):

    $text = preg_replace('/\[.*\]/', '', strip_tags($post->post_content, $allowed_tags));

    … into this:

    $text = preg_replace('/\[.*\]/', '', strip_tags($post->post_content, $allowed_tags));
    // remove smart youtube links
    $text = preg_replace("/http(v|vh|vhd|vp):\/\/([a-zA-Z0-9\-\_]+\.|)youtube\.com\/watch(\?v\=|\/v\/|#!v=)([a-zA-Z0-9\-\_]{11})([^\s<]*)/", "", $text);

    You, SIR, are a Godsent!
    It worked.
    I will keep this code as a reference.

    Thanks so much!

    You’re welcome 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘[Plugin: WordPress Popular Posts] [Plugin: WordPress Popular Post] How prevent specific code to appe’ is closed to new replies.