/ Published in: PHP
                    
                                        
post thumbnail function and display as background if function exists
                
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
// register post thumbnail function
if ( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_image_size( 'company-logo',90, 55 ); //300 pixels wide (and unlimited height)
}
// display if function exists
<?php $src = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), $size='company-logo', true, '' ); ?>
<?php if( has_post_thumbnail() ) { ?>
<div class="company_thumbnail" style="background: #FFF url(<?php echo $src[0]; ?>) no-repeat center center !important;">
</div>
<?php } ?>
Comments
 Subscribe to comments
                    Subscribe to comments
                
                