Tagged: featured image
-
AuthorPosts
-
June 3, 2014 at 9:48 pm #274226
The featured image for a single post appears to be displayed at the same height and cuts off the top and bottom of an image. How do you set the featured image so that the whole image is displayed on the single post instead?
My current theme configuration is:
Enfold Theme Options > Blog Layout > Single Post Options > Single post with big preview imageCurrent image size uploaded: 1066 w x 600 h
However, the image height is cropped in the single post to about 360px.
Thanks!
June 3, 2014 at 9:51 pm #274231Hi,
Open and look for line:
$avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360 ); // images for fullsize pages and fullsize slider
Replace it by this:
$avia_config['imgSize']['entry_without_sidebar']= array('width'=>1066, 'height'=>600 ); // images for fullsize pages and fullsize slider
After you done that, regenerate the thumbnails:
http://wordpress.org/plugins/regenerate-thumbnails/Regards,
JosueJune 3, 2014 at 10:06 pm #274239The problem with that approach is that it assumes that all featured images will be uploaded at the same size.
June 3, 2014 at 10:09 pm #274245Well, that’s how it’s intended to work.
However, there is a way to change that, open includes/loop-index.php and look for line 34:
$current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], $size);
Change it to:
$current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], "full");
Cheers!
JosueJune 3, 2014 at 10:18 pm #274255Thanks. It would be good if that were an option in the Blog Layout section of the theme options rather than having to update the source. I’m sure that change will be gone the next time an update is pushed out.
June 3, 2014 at 10:21 pm #274258Not necessarily, you can have this mod in a child theme. A duplicate of includes/loop-index.php in the child folder will do the trick.
Regards,
JosueJune 3, 2014 at 10:25 pm #274266What happens if you make changes to the loop-index file in the next Enfold release? How would these be reflected in the child theme? Thanks.
June 3, 2014 at 10:30 pm #274271The thing is that doesn’t happen too often, but if it does you would need to merge it which is not a big deal, after all the mod is just a line change.
Cheers!
JosueJune 3, 2014 at 10:35 pm #274273True… but only as long as I remember the change. :)
June 3, 2014 at 10:41 pm #274281Hehe, that’s how things work right now, feel free to request it here as a feature for future updates.
If you have any additional questions please let me know :)
Cheers!
JosueJune 13, 2014 at 12:12 am #278387i was trying to follow this and got confused. I don’t know what size to make the image for single post. Won’t it scale from there?
June 13, 2014 at 12:17 am #278389Please elaborate on your issue @kbarranco.
Regards,
JosueJune 13, 2014 at 12:22 am #278392my image is too big: http://www.hatchnola.com/wk-kellogg-foundation-honor/
I would like to make the image more narrow, but how will it look on the homepage if my client uploads an odd shaped image?- This reply was modified 10 years, 5 months ago by kbarranco.
June 16, 2014 at 7:52 am #279273Hi!
You can modify Josues code here: https://kriesi.at/support/topic/how-to-adjust-featured-image-height-in-single-post/#post-274245 and use a different thumbnail size for single posts.
Replace:
$current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], $size);
with
$size = (is_single()) ? "square" : "full"; $current_post['slider'] = get_the_post_thumbnail($current_post['the_id'], $size);
You can replace “square” with another thumbnail size like ‘masonry’, featured’, ‘featured_large’, ‘portfolio’, ‘gallery’, ‘entry_with_sidebar’,’entry_without_sidebar’,extra_large’ or “magazine”.
Best regards,
PeterJune 16, 2014 at 8:53 am #279294ok- I’ll have to sit with this a while. I am not a programmer and sometimes this hurts my brain ;)
June 19, 2014 at 5:30 am #280989Hi!
Please let us know if it works. We added a conditional statement on $size variable that will assign a different thumbnail size, square in this case, on the slider. As Dude described, you can use different thumbnail size. If you want to know where these thumbnails are coming from, check functions.php, find this codes:
$avia_config['imgSize']['widget'] = array('width'=>36, 'height'=>36); // small preview pics eg sidebar news $avia_config['imgSize']['square'] = array('width'=>180, 'height'=>180); // small image for blogs $avia_config['imgSize']['featured'] = array('width'=>1500, 'height'=>430 ); // images for fullsize pages and fullsize slider $avia_config['imgSize']['featured_large'] = array('width'=>1500, 'height'=>630 ); // images for fullsize pages and fullsize slider $avia_config['imgSize']['extra_large'] = array('width'=>1500, 'height'=>1500 , 'crop' => false); // images for fullscrren slider $avia_config['imgSize']['portfolio'] = array('width'=>495, 'height'=>400 ); // images for portfolio entries (2,3 column) $avia_config['imgSize']['portfolio_small'] = array('width'=>260, 'height'=>185 ); // images for portfolio 4 columns $avia_config['imgSize']['gallery'] = array('width'=>710, 'height'=>575 ); // images for portfolio entries (2,3 column) $avia_config['imgSize']['magazine'] = array('width'=>710, 'height'=>375 ); // images for magazines $avia_config['imgSize']['masonry'] = array('width'=>705, 'height'=>705 , 'crop' => false); // images for fullscreen masonry $avia_config['imgSize']['entry_with_sidebar'] = array('width'=>710, 'height'=>270); // big images for blog and page entries $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1030, 'height'=>360 ); // images for fullsize pages and fullsize slider
Cheers!
IsmaelAugust 22, 2016 at 11:37 am #675640Hello!
This is all great but what happens with the changes in functions.php when Enfold is later updated?
I’m using child-theme but when I insert the above functions in the child themes functions.php they don’t work. They only work in parent theme functions.php.August 24, 2016 at 5:51 am #676777February 28, 2017 at 7:43 pm #753172Hi, after hour and hour I find the Josue’s advice, that is a solution for my problems. Is there a way to obtain same result ( full size featured image) on mobile version of my site? Thanks
March 6, 2017 at 7:51 am #756197Hi!
@aka-alex: Please create a new thread or post then provide the url to the page. The modification above should affect the desktop and the mobile view as well.Best regards,
IsmaelMarch 6, 2017 at 12:49 pm #756339Thanks for all Ismael
March 7, 2017 at 5:24 am #756733Hi!
We replied in your own thread: https://kriesi.at/support/topic/show-different-featured-image-slider-on-mobile/
We’ll close this thread now.
Best regards,
Ismael -
AuthorPosts
- The topic ‘How to adjust featured image height in single post’ is closed to new replies.