-
AuthorPosts
-
February 26, 2018 at 10:40 pm #918065
I’m trying to change the cropping for the big, first image in the Magazine element. Looks to me like if I just change the number on line 163 of functions.php from 710 x 375 to 495 x 400, I should be in business, but I’d like to handle that via my child theme — can you tell me how do that? Can I put a functions.php file in my child theme, and if so exactly what code should be in that child function.php file in this case?
This is for https://www.waternewsnetwork.com/ — but I have a Coming Soon plugin activated there, so you’ll need to be logged into the admin to see it. I’ll give you credentials in the Private Content field.
Thanks and let me know if you have any questions.
February 27, 2018 at 1:34 am #918124Hey sky19er,
Please refer to Yigit’s post here:
https://kriesi.at/support/topic/enfold-image-sizes/#post-336176
If that code is placed at the bottom of your childs functions.php file you should be in business.
Best regards,
Jordan ShannonFebruary 27, 2018 at 1:46 am #918125Thanks, but how do I set up the child functions.php file? If I just copy the functions file to the child theme it breaks the site. Sorry, I can’t seem to find those instructions. Thanks!
February 27, 2018 at 8:35 am #918269Hi,
For the image sizes, I would suggest using this plugin: https://wordpress.org/plugins/simple-image-sizes/ after installing and activating the plugin, go to Settings > Media and you should be able to see all image sizes and make changes there. Hope this helps :)
Best regards,
NikkoFebruary 27, 2018 at 8:56 am #918274the very first trial would be to go to https://kriesi.at/documentation/enfold/
there you can find : https://kriesi.at/documentation/enfold/portfolio-item/create-a-child-theme/
but i think this will be more informative: https://kriesi.at/documentation/enfold/using-a-child-theme/February 27, 2018 at 10:38 am #918340February 28, 2018 at 12:55 am #918755Thanks @guenni007, that got me to the point where the functions.php file in my child theme isn’t breaking the site ;) So now I have the following in my child theme functions.php file. As you can see, I’ve changed the magazine line to use the same 495 x 400 used by the portfolio line. It doesn’t seem to be working — am I missing some code here, or do you have any other clues for me?
(@Nikko, thanks for the plugin suggestion, but I’d rather not just change all the 710 x 375 images generated by enfold to 495 x 400 — I’d rather just change what the magazine element uses and still have that 710 x 375 size available for other uses.)
<?php $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'=>845, 'height'=>684 ); // images for portfolio entries (2,3 column) $avia_config['imgSize']['magazine'] = array('width'=>495, 'height'=>400 ); // 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'=>845, 'height'=>321); // big images for blog and page entries $avia_config['imgSize']['entry_without_sidebar']= array('width'=>1210, 'height'=>423 ); // images for fullsize pages and fullsize slider $avia_config['imgSize'] = apply_filters('avf_modify_thumb_size', $avia_config['imgSize']);
March 1, 2018 at 10:50 am #919527Hi,
Did you regenerate the images after adjusting the thumbnail size? Adjusting that code won’t work without regenerating or re-uploading the images.
Best regards,
IsmaelMarch 1, 2018 at 5:07 pm #919758i only knew the code to add or overwrite a given image-size by : https://kriesi.at/support/topic/override-the-global-avia_config-in-a-child-theme/#post-714683
so this code above is all you have inserted in your functions.php – i guess that there will be no effect (even after regenerating thumbnail sizes)and if new size is not selectable on alb element you can add with code here:
https://kriesi.at/support/topic/more-image-sizes-in-folder-than-available-to-insert/#post-455442March 1, 2018 at 5:27 pm #919767and if you like to redefine the whole thing and add new sizes :
https://kriesi.at/support/topic/adding-image-size-to-attachment-display-settings/#post-363481March 1, 2018 at 5:30 pm #919769@Ismael — I did regenerate images and also tried re-uploading, just in case. The image I’m uploading is 720 x 465, so, as I understand it, it should crop to my new 495 x 400 size (since it’s bigger than that in both directions). But, BTW, should I even have to regenerate/re-upload since I’m just switching the Magazine size to use a thumbnail size already available in the theme?
@Guenni007 — Thanks, but I’m not trying to add a new size to the array, I’m just trying to tell the Magazine element to grab a different size — a size that’s already available in the theme. So I think it’s a little different solution than you’re referring to. But I could be wrong ;)March 1, 2018 at 5:41 pm #919774and if you like to modify an existing size:
(i think the modify filter still exists) look for avf_modify_thumb_sizeMarch 1, 2018 at 5:53 pm #919779on your code above it looks like you want to redefine the magazine size.
redefine existing sizefunction custom_modified_thumb_sizes( $size ){ $size['square'] = array('width'=>300, 'height'=>300 ); return $size; } add_filter('avf_modify_thumb_size', 'custom_modified_thumb_sizes', 10, 1 );
if you like to have f.e. masonry and magazine sizes to be selectable on image alb :
add_filter( 'image_size_names_choose', 'avia_add_selectable_images' ); function avia_add_selectable_images($sizes) { $newsize = array ( 'masonry' => __('Masonry Thumbnail','avia_framework'), 'magazine' => __('Magazine Thumbnail','avia_framework') ); if(isset($newsize)){ $sizes = array_merge($sizes, $newsize); } return $sizes; }
- This reply was modified 6 years, 8 months ago by Guenni007.
March 1, 2018 at 6:53 pm #919803March 7, 2018 at 9:35 pm #923345OK, @Guenni007 — putting the following in my child’s function.php file and re-uploading the images at a size greater than 495×400 worked! (note: regenerating the thumbnails with the Regenerate Thumbnails by József Koller plugin did not seem to work for me/this).
I’m curious, do you know what the 10, 1 refers to in the function?
Regardless, this solved my issue / answered my question — thanks so much!!
<?php
function custom_modified_thumb_sizes( $size ){
$size[‘magazine’] = array(‘width’=>495, ‘height’=>400 );
return $size;
}
add_filter(‘avf_modify_thumb_size’, ‘custom_modified_thumb_sizes’, 10, 1 );March 8, 2018 at 7:28 am #923600Hi sky19er,
Great, glad you got it working. 10 and 1 is the priority of loading and the amount of accepted arguments: https://developer.wordpress.org/reference/functions/add_filter/
Best regards,
RikardMarch 8, 2018 at 7:31 am #923602Ahh, ok, thanks!
March 21, 2018 at 6:31 pm #930738Actually, FYI, I realize the code I ended up using, above, in my Mar 7 post, still just changes the size of the Magazine thumb, which is not actually what I was looking for. What I was actually looking for is a snippet that would set the Magazine element to use the Portfolio thumb. Instead of using the code above, yes, I may as well just use the Simple Image Sizes plugin and just change the size of the Magazine thumb.
Anyway, I’m giving up on this now and just settling for the plugin solution — just wanted to note this for anyone who may be looking for the same solution I was.
Thanks anyway.
March 22, 2018 at 7:44 am #931084Hi sky19er,
Thanks for the feedback, much appreciated. Please let us know if you should need any further help on the topic or if we can close it.
Best regards,
RikardMarch 22, 2018 at 8:33 pm #931607Oh, also, on Mar 7th I mentioned regenerating the thumbs didn’t seem to work for me, but I think I just wasn’t hitting the right sequence to regenerate thumbs in the Simple Image Sizes plugin. Yeah, as far as I’m concerned, you can close this topic. Thanks again.
March 22, 2018 at 8:38 pm #931610Hi,
I’m glad you were able to get this corrected. If you need additional help, please let us know here in the forums.
Best regards,
Jordan Shannon -
AuthorPosts
- The topic ‘modify functions.php via child theme’ is closed to new replies.