Featured Image keeps cropping
-
After spending 3 evenings trying to figure this out I’m throwing it out to you guys…its driving me insane.
This should be simple – I have built a custom theme, and all I want to do is display a thumbnail that links to a lightbox effect once clicked.
I want my dimensions to be 214 width x unlimited height for the thumbnail, and 500 width x unlimited height for the lightbox effect. No cropping.
What I get from the code I currently have is a cropped thumbnail at 214 x 214 and cropped lightbox at 500 x 500.
Why is it cropping? I have checked the media settings within my wordpress admin and this makes no difference – assuming my code is overwriting these setting anyway (?)
In my function I am using the following code:
add_action( 'wp_enqueue_scripts', 'brian_scripts' ); if ( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 214, 9999, false ); add_image_size('large', 500, 9999, true); //custom size }And to display them I’m using:
`<?php
/*Template Name: Archive Canvases*/
?><?php get_header(‘archivecanvas’); query_posts(‘cat=4&order=ASC’); ?>
<div class=”header archivecanvasheader”>
<h1><?php the_title(); ?></h1>
</div>
<div class=”mainContent”><?php if (have_posts()) { ?>
<?php while (have_posts()) : the_post(); ?><div id=”archiveContainer”>
<div id=”archivePic”><a rel=”lightbox” href=”<?php $image_id = get_post_thumbnail_id();
$image_url = wp_get_attachment_image_src($image_id,’large’, true);
echo $image_url[0]; ?>”><?php if ( has_post_thumbnail() ) {
the_post_thumbnail();
}
?></a></div>
<div id=”archivecanvasContent”>
<h2><?php the_title(); ?></h2>
<div class=”date”><?php the_time(‘Y’) ?></div>
<p><?php the_excerpt(); ?></p></div>
</div>
<?php endwhile; ?><?php } ?>
<?php posts_nav_link(); ?></div><?php get_footer(); ?>`
Can anyone help or have any ideas if something else is overriding this?
The topic ‘Featured Image keeps cropping’ is closed to new replies.