0

I have a very simple template where I am showing images. The code looks like this:

<?php 
/*
* Template Name: Portfolio
*/
 ?>

 <?php get_header(); ?>

 <div class="row">
    <div class="small-12 columns">

        <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

        <?php 

        the_content();

        ?>

        <?php endwhile; else: ?>
        <p><?php _e('Sorry, no posts matched your criteria.'); ?></p>
        <?php endif; ?>

    </div> <!-- #small-12 -->
 </div> <!-- #row -->

 <?php get_footer(); ?>

The problem is that when I upload my images in the editor, they become much smaller than they actually are (on the page). I control their size by setting max-width: 100% in my css already, so I don't want WordPress to limit the size. How can I remove this?

0

WordPress creates 3 different sizes as far as my research goes. Read this on WP image handling -> http://www.studiograsshopper.ch/web-development/wordpress-featured-images-add_image_size-resizing-and-cropping-demo/

You can easily customise the default Media sizes by changing the default sizes in Dashboard > Settings > Media.

You can grab any of those sizes. See the codex @ http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

The function you want is:

get_the_post_thumbnail( $post_id, $size, $attr )

And here's an example:

get_the_post_thumbnail($post_id);                  // without parameter -> Thumbnail

get_the_post_thumbnail($post_id, 'thumbnail');     // Thumbnail
get_the_post_thumbnail($post_id, 'medium');        // Medium resolution
get_the_post_thumbnail($post_id, 'large');         // Large resolution
get_the_post_thumbnail($post_id, 'full');          // Original resolution

get_the_post_thumbnail($post_id, array(100,100) ); // Other resolutions
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.