• rtfrisk

    (@rtfrisk)


    Is there a way to fallback to the ‘Default image URL:’ specified in the event that a post doesn’t have a featured image? Rather than using the next image found in the post?

    • This topic was modified 8 years ago by rtfrisk.
    • This topic was modified 8 years ago by rtfrisk.
    • This topic was modified 8 years ago by rtfrisk.
Viewing 1 replies (of 1 total)
  • Thread Starter rtfrisk

    (@rtfrisk)

    Changed

    if ( $from_post_body ) { // Theme does not support post-thumbnails, or post does not have assigned thumbnail
    	$debug .= 'Getting image from post body;';
    	$wud = wp_upload_dir();
    	preg_match_all( '|<img.*?src=[\'"](' . $wud['baseurl'] . '.*?)[\'"].*?>|i', $post->post_content, $matches ); // searching for the first uploaded image in text

    to

    if ( $from_post_body ) { // Theme does not support post-thumbnails, or post does not have assigned thumbnail
    	$debug .= 'Skipping getting image from post body and falling back to default;';
    	$url = get_option( 'relpoststh_default_image', $this->default_image );

    in wp-content/plugins/related-posts-thumbnails/related-posts-thumbnails.php – line 314.

    • This reply was modified 8 years ago by rtfrisk.
    • This reply was modified 8 years ago by rtfrisk.
Viewing 1 replies (of 1 total)
  • The topic ‘Show ‘Default image URL:’ if a featured image isn’t specified’ is closed to new replies.