WordPress.org

Support

Support » Plugins and Hacks » the_post_thumbnail('medium'); instead of the default 150×150 in modern layout?

the_post_thumbnail('medium'); instead of the default 150×150 in modern layout?

Viewing 2 replies - 1 through 2 (of 2 total)
  • is this the function that gets thumbnail from posts?

    function wp_rp_upload_attachment($url, $post_id) {
    	/* Parts copied from wp-admin/includes/media.php:media_sideload_image */
    
    	include_once(ABSPATH . 'wp-admin/includes/file.php');
    	include_once(ABSPATH . 'wp-admin/includes/media.php');
    	include_once(ABSPATH . 'wp-admin/includes/image.php');
    
    	$tmp = download_url($url);
    	preg_match( '/[^\?]+\.(jpe?g|jpe|gif|png)\b/i', $url, $matches);
    	$file_array['name'] = sanitize_file_name(urldecode(basename($matches[0])));
    
    	$file_array['tmp_name'] = $tmp;
    	if (is_wp_error($tmp)) {
    		@unlink($file_array['tmp_name']);
    		return false;
    	}

    I can’t find the call “the_post_thumbnail” anywhere in the code, i’m guessing it falls back on the built in code? is there any simple way to modify this to get the medium or large size thumbnail from post instead of the default one? i can do the css work for template easily, i just need help getting the code to grab the correct thumbnail.

    Plugin Author PetraP

    @petrap

    Hey jeriksson.

    thanks for reaching out – I’ll gladly help!
    You don’t need to change any functions or files. Please go to plugin settings->”Advanced settings”->”Customize” and tick the box next to “Enable custom CSS”. You need to tick the box next to the “Use Custom Size Thumbnails” also (enter the dimensions you wish for the thumbnails to be). Now in the custom CSS “box” add e.g. width:350px !important; and height:150px !important; between ul.related_post li img {..here...} brackets. Also, add width:350px !important; between ul.related_post li {....here...}. Don’t forget to save the changes. Check the screenshot for easier navigation.

    Everything put together should look like this:`

    .related_post_title {
    }
    ul.related_post {
    }
    ul.related_post li {
    width:350px !important;
    }
    ul.related_post li a {
    }
    ul.related_post li img {
    width:350px !important;
    height:150px !important;
    }

    Hope this helps!

    Please let me know how it goes,
    Petra

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘the_post_thumbnail('medium'); instead of the default 150×150 in modern layout?’ is closed to new replies.