Hi,
Here is an example for post thumbnail, where I wrap the image in a div
Both the image is clickable.
<?php if(has_post_thumbnail()): ?>
<div class="cms-image" style="float: left;">
<a href="<?php the_permalink() ?>"> <?php the_post_thumbnail(); ?></a>
</div>
<?php endif; ?>
HTH
David
David,
Thanks a lot for your reply.
On the front page of the site I posted above, it gathers the images that were put into each article written, throws the newest ones on the front page of the site and archives the older ones into subcategories.
Would the above code you offered work for that? Would you mind helping me with where I would place it in the above code?
Any help would be appreciated and again, thanks for helping!
try… justin tadlock’s “get the image” plugin
Perth,
That plugin is PERFECT!
Thanks a lot for the help!
One question though, and I can’t seem to find the answer online.
If I post this code.
<?php get_the_image( array( 'custom_key' => array( 'feature_img' ), 'size' => 'medium', 'width' => '304', 'height' => '98', 'image_class' => 'feature' ) ); ?>
It will shrink the image down to the size I need it, but it shrinks the entire image when all I need it to do is crop it to that size.
If you notice the site in my first post, the images are just cropped to that size and not “resized” if that makes sense.
In the above line of code, do you have any suggestions for me to get it to crop the image like it does already?
Thanks again for the suggestion!
change the crop setting in the media tab
Perth,
Thanks for the suggestion, that was what I originally had taken a look at. But it seems the crop code if overwritten when implementing the plugin.
Do you have any direction I should go in? And your help is greatly appreciated yet again.
In your functions.php look and see if post thumbnails are activated, and use add_image_size for your custom images.
// This theme uses post thumbnails
add_theme_support( 'post-thumbnails' );
// We'll be using custom post thumbnails.
set_post_thumbnail_size( 120, 90, true );
// Add a couple of Custom Imasge Sizes
if ( function_exists( 'add_image_size' ) ) {
add_image_size( 'large-thumbnail', 200, 150, true );
add_image_size( 'small-thumbnail', 100, 75 );
}
Call the image size you want in your loops, large thumbnail and post excerpt, this is just an example.
<div class="entry-content">
<?php /* Add a conditional image and excerpt output */ ?>
<?php if(has_post_thumbnail()): // Start the condition ?>
<div class="alignleft" style="margin: 0 0 10px 0">
<?php the_post_thumbnail('large-thumbnail'); ?>
</div>
<?php the_excerpt(); ?>
<?php else : // Offer an alternative ?>
<?php the_content( __( 'Continue reading <span class="meta-nav">→</span>', 'twentyten' ) ); ?>
<?php endif; // end the condition ?>
<?php wp_link_pages( array( 'before' => '<div class="page-link">' . __( 'Pages:', 'twentyten' ), 'after' => '</div>' ) ); ?>
</div><!-- .entry-content -->
If you are still not sure work through this twenty ten tutorial.
In the link you posted it is a mixture of post images and two column and the columns in the link are 310px, so you could add
add_image_size( 'large-thumbnail', 300, 100, true );
The images in your link are 310px * 100px, these are crops of a full size image!
HTH
David
Hey guys,
I apologize it has taken so long to get back to your replies. They have been greatly appreciated! I am still incredibly confused and I cannot seem to get the code to do what I want.
I am using the get-the-image plugin but I am not having any luck maintaining the size of the images to what I originally want.
Unfortunately, this theme was created prior to the site owners asking for my help and they insist on wanting to keep it, which I can understand. If anyone can help me more on this, I would be incredibly grateful. I know it’s a headache to help a “noob” but the more help I get, the less questions I’ll have to ask! 😀
Thanks in advance.
I am just gonna bump this up. Any help would be greatly appreciated. This is the only thing left I need to finish the site.