WordPress.org

Support

Support » Plugins and Hacks » Auto Post Thumbnail » [Plugin: Auto Post Thumbnail] Adding Shortcode

[Plugin: Auto Post Thumbnail] Adding Shortcode

  • Recently I used this plugin and Auto Featured Image, but both didn’t do what I wanted them to do.

    So investigating their code, they were only searching the content pre-shortcode execution. So if anyone is using a shortcode to post images or videos, then this plugin wasn’t working so well.

    So for Auto Post Thumbnail, in the file auto-post-thumbnail.php, if you insert
    $post_content = do_shortcode($post[0]->post_content); above preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); and change preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post[0]->post_content, $matches); to preg_match_all('/<\s*img [^\>]*src\s*=\s*[\""\']?([^\""\'>]*)/i', $post_content, $matches); then it will execute shortcodes before assigning the post thumbnail. This is important for those who use shortcodes to display images (or even videos in Auto Featured Image Plugin).

  • The topic ‘[Plugin: Auto Post Thumbnail] Adding Shortcode’ is closed to new replies.
Skip to toolbar