Viewing 4 replies - 1 through 4 (of 4 total)
  • you do this when yo insert the image into the text of your post/page.

    you can edit the image, and use the advanced option to set the image size exact to the pixel

    Thread Starter leegee

    (@leegee)

    Sorry I wasn’t clear.

    I have a category whose posts consist of a single, captioned image.

    index.php currently renders each image in a different size container, with attributes to allow CSS to change the apparent size.

    But still lots of large images are downloaded.

    I would like to be able to specify what size of image is to be downloaded – thumbnail, medium, original.

    Is that possible? Will I need to subclass the_content() ?

    Thanks
    Lee

    hi leegee

    i’ve the same problem, how did you managed?

    thanks

    Just customize the loop for that particular category. e.g.

    Here’s the normal loop:

    <?php
    if ( have_posts() ) : while ( have_posts() ) : the_post();
        // NORMAL LOOP OUTPUT GOES HERE
    endwhile; endif;

    You’re going to replace // NORMAL LOOP OUTPUT GOES HERE with something like this:

    if ( in_category( $id ) ) {
         $attachment_images = get_posts( array(
             'post_type' => 'attachment',
             'numberposts' => 1,
             'post_parent' => $post->ID
         ) );
         $attachment_image = $attachment_images[0];
         wp_get_attachment_image( $attachment_image->ID, 'large' );
    } else {
        // NORMAL LOOP OUTPUT GOES HERE
    }
     ?>
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘image size in the_content’ is closed to new replies.