WordPress.org

Ready to get started?Download WordPress

Forums

  1. unifiedac
    Member
    Posted 1 year ago #

    I've installed Wp-Thumbie version 0.1.9 on my WP 3.5.1 installation and everything works fine. You can see a working version here at the bottom of the post:

    WordPress Car Dealer Theme

    I had to do some custom CSS to get the grid layout and opacity effect, but I think everything turned out fine. I also edited the plugin code to add an alt element to each image and forced it to use the featured image instead of a random image from the post.

    http://wordpress.org/extend/plugins/wp-thumbie/

  2. unifiedac
    Member
    Posted 1 year ago #

    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
       }

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic