Viewing 1 replies (of 1 total)
  • Thread Starter B & L Marketing

    (@unifiedac)

    Here is the code I changed to line 87-104 of wp-thumbie.php to pull featured images instead of random image:

    foreach($searches as $search) {
       $categorys = get_the_category($search->ID);	//Fetch categories of the plugin
       $featured_image = wp_get_attachment_image_src( get_post_thumbnail_id( $search->ID ), 'single-post-thumbnail' );
       $p_in_c = false;	// Variable to check if post exists in a particular category
       $title = trim(stripslashes($search->post_title));
       if ($crp_settings[display_post_text]) {
       $post_text = strip_tags($search->post_content);
       //$post_text = wp_trim_excerpt($post_text); // Get Post Ecerpt
       $post_text = truncate($post_text,$crp_settings[post_text_char]); // Get Post Excerpt
       }
       $image = ""; // Null Variable to verify for no image found case
    
       preg_match_all( '|<img.*?src=[\'"](.*?)[\'"].*?>|i', $search->post_content, $matches );
       if ( isset( $matches ) ) $image = $featured_image[0];
    
       if (strlen(trim($image))==0) {
       $image = $pluginDir.'images/default.png' ; // when no image found in post
       }
Viewing 1 replies (of 1 total)
  • The topic ‘Works on 3.5.1’ is closed to new replies.