meximelt
Member
Posted 1 year ago #
I have a website with a theme that has Featured Images built in. I added a featured image to my post, but it is too big when it displays on my homepage.
I already googled, but could not find a code snippet that worked just for reducing the homepage Featured Image for a post.
Thanks
meximelt
Member
Posted 1 year ago #
meximelt
Member
Posted 1 year ago #
review:
http://codex.wordpress.org/Post_Thumbnails
http://codex.wordpress.org/Function_Reference/add_image_size
http://codex.wordpress.org/Conditional_Tags#The_Main_Page
// in functions.php
if ( function_exists( 'add_image_size' ) ) {
// set image size here
add_image_size( 'homepage-thumb', 300, 9999 );
}
// in index.php (or whatever template file shows your front page)
if(is_home()){
if ( has_post_thumbnail() ) {
the_post_thumbnail( 'homepage-thumb' );
}
}
meximelt
Member
Posted 1 year ago #
I did that and nothing has changed :(
Sometimes you need to re-upload images before the new size is shown. You can also do this with a plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/
meximelt
Member
Posted 1 year ago #
We are getting somewhere!
Added the plugin, regenerated images, and the latest posts image was added in the thumbnail format at the top right corner of the page, all by itself. The post's featured image on the homepage was not resized though.
It doesnt change the post's featured image on homepage, just adds one small thumbnail is position depending where I post the code in Index.php
I'll mess around a bit more, but any idea?
meximelt
Member
Posted 1 year ago #
Got it!
I replaced the "archive-thumb" in the image.php file with "homepage-thumb", still having the add_image_size in the functions.php and it worked. Thanks for the Image Regenerator plugin, as I have to regenerate everytime I try and make the size right.
Mey Samorn
Member
Posted 9 months ago #
No plugin need, just add width:1004px; and i just found it! this is my site that come with build in featured slide. to change it go to style.css or css in your theme:
under
/* ={ FEATURED SLIDER - LARGE} */
find
#featured_a_posts .item .featured_media {border:1px solid #aaa;display:block;}
change to
#featured_a_posts .item .featured_media {width:1004px; border:1px solid #aaa;display:block;}
Note: width:1004px for my site.
thanks