WordPress.org

Ready to get started?Download WordPress

Forums

Wp-Thumbie - Related Posts with thumbnails for WordPress
[resolved] [Plugin: Wp-Thumbie] Caption shortcode shows up in description (SOLUTION) (2 posts)

  1. Viktor Nagornyy
    Member
    Posted 4 years ago #

    WP-Thumbie is a great plugin. I noticed it didn't strip [caption] shortcode, so when you have an image at the beginning of your post it will show up in related posts description, pretty ugly. I'm not code, but I spent some time and figured out how to get rid of it. Thought I share in case someone else needs it.

    Look for wp-thumbie.php in the plugin's directory. Now, look for this line:
    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    Once you find it, you will need to paste this new line right after the one you just found:
    $post_text = preg_replace("/\[caption[^>]+\[\/caption\]/i", "", $post_text);
    This basically replaces [caption] with nothing. So, once you done this is what it should look like:

    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    			$post_text = preg_replace("/\[caption[^>]+\[\/caption\]/i", "", $post_text);

    It should work right away =)

    Hope this helps you out.

  2. sirajcmr
    Member
    Posted 3 years ago #

    Hi :)

    This worked, excellent help, I was looking for this info long time..

    Now my code looks like this and working fine :)

    $post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
    $post_text = preg_replace("/\[caption[^>]+\[\/caption\]/i", "", $post_text);
    $post_text = truncate($post_text,$crp_settings[post_text_char]); // Get Post Excerpt
    }
    $image = ""; // Null Variable to verify for no impage found case

    :)
    Cheers mate

    SiRu

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags