Tagged: child theme, responsive, video
-
AuthorPosts
-
July 21, 2014 at 5:22 am #293721
Hello, I am trying to edit the Featured Image size by adding the following line to functions.php in my Child Theme. It appears that the Child functions.php is not overriding the Parent functions.php.
—————————————————————-
$avia_config[‘imgSize’][‘entry_with_sidebar’] = array(‘width’=>710, ‘height’=>270); // big images for blog and page entries
—————————————————————-I have renamed my Child Theme to something but made sure that the Template is set to “enfold”
Can someone please help. Thank you.
July 21, 2014 at 10:28 am #293767Hi Webbee!
Thank you for using our theme.
The problem is, that functions.php from the parent themes overwrites your settings of the child them, because it is loaded after your code.
You have to put your code in the child theme in an action hook:
function my_image_size() { global $avia_config; $avia_config['imgSize']['entry_with_sidebar'] = array(‘width’=>710, ‘height’=>270); // big images for blog and page entries } add_action('init', 'my_image_size', 1);
Regards,
GünterJuly 21, 2014 at 6:50 pm #293964Thank you Gunter but it is still not working. The following is my Child functions.php
———————————————————-
<?php
/*
* Add your own functions here. You can also copy some of the theme functions into this file.
* WordPress will use those functions instead of the original functions then.
*/function my_image_size()
{
global $avia_config;$avia_config[‘imgSize’][‘entry_with_sidebar’] = array(‘width’=>710, ‘height’=>360); // big images for blog and page entries
}add_action(‘init’, ‘my_image_size’, 1);
July 21, 2014 at 10:20 pm #294056Hey!
Using this plugin is the best option in this case: http://wordpress.org/plugins/simple-image-sizes/
It will allow you to modify the sizes and regenerate from within the WordPress admin.
Regards,
DevinJuly 21, 2014 at 11:00 pm #294064Thank you Devin but I would like to use the functions.php in the child theme. I need to perform other edits as well so I need to know why the child is not overriding the parent. I also prefer to use the least amount of plugins.
Thank you.
July 22, 2014 at 4:34 am #294146Hi!
Gunter’s code should work. Did you upload the image again or regenerate the thumbnails? Use can use the suggested plugin above to regenerate the thumbnails or use this one: http://wordpress.org/plugins/regenerate-thumbnails/
Best regards,
IsmaelJuly 22, 2014 at 9:30 am #294233Yes I did upload the image again but did not work. The code should work but my concern is why is it not working? As I mentioned before I would like to get the child functions.php working as I need to perform some more modifications that will require me to add to the child functions.php. What else can I do or try. I should be able to perform this simple edit without a plugin
Thanks again
July 22, 2014 at 10:02 am #294247July 22, 2014 at 6:01 pm #294506This reply has been marked as private.July 22, 2014 at 6:33 pm #294516Hey!
We’ll add a filter for the image sizes with the next update. You can use it like:
function my_image_size($sizes) { $sizes['entry_with_sidebar'] = array('width'=>710, 'height'=>360); // big images for blog and page entries return $sizes; } add_filter('ava_registered_thumbnail_sizes', 'my_image_size', 10, 1);
I added it to your functions.php file manually but the next update will come with this filter out of the box.
Regards,
PeterJuly 22, 2014 at 7:52 pm #294541Thank you very much for looking into this. I see that the Parent functions.php was accessed. Was this file modified or was just the Child functions.php modified?
July 23, 2014 at 7:41 am #294801Hey!
Yes, Dude modified the functions.php to add the filter function.
$avia_config['imgSize'] = apply_filters('ava_registered_thumbnail_sizes', $avia_config['imgSize']);
Best regards,
IsmaelAugust 29, 2014 at 10:37 pm #311102Hello,
Three questions please – (perhaps one should actually be in a different post?)
1. I want to do the same as webbee – modify the child functions.php file to change image sizes. Do I understand correctly from this thread that this is not possible right now? I def. prefer not to add plugins unless absolutely necessary, but it sounds like the parent functions.php had to be modified. Yes or no? If so, how do I do this and will I lose the change with an update?2. You said above “You have to put your code in the child theme in an action hook:” If I post the code (I’ve copied in below) into the child functions.php file – exactly what needs to be posted with it to make it override the parent?
I changed to Enfold from another theme (loving it so far) and know that I need to regenerate the thumbnails, but I would like to set and test sizes. I want to test with how big images can be without slowing down site and see how various options look before making a decision about the final layout. Last question may belong in another post, but I can’t find search results that address it and this is what I hope to do with the child theme…
3. Since my site features video and websites, I want proportions to be (at least roughly) 16:9 for all thumbs/images associated with the video category, post format and specific tags. (It would be cool to have 4:3 or even square for the website items, but I can live without that if needed.) The site is small/new enough that I can delete and re-upload images if necessary, because speed on mobile vs great looking video is the decision I am facing when I select optimal sizes.
I’m starting with 1920X1080 images (or could use 1280X720) as large screen shots for videos, but can anyone advise/explain what – if anything – will happen to the responsive/mobile version if I start changing the proportion here?
I did find the section (copied below) in the parent functions file that I assume I would need to modify:/* * Register additional image thumbnail sizes * Those thumbnails are generated on image upload! * * If the size of an array was changed after an image was uploaded you either need to re-upload the image * or use the thumbnail regeneration plugin: http://wordpress.org/extend/plugins/regenerate-thumbnails/ */ $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 //overwrite blog and fullwidth image on extra large layouts if(avia_get_option('responsive_layout') == "responsive responsive_large") { $avia_config['imgSize']['gallery'] = array('width'=>845, 'height'=>684 ); // images for portfolio entries (2,3 column) $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 }
Is there an easier/simpler way to approach this? Anyone else doing mostly video who has a solution?
Thanks so much for any assistance with this.- This reply was modified 10 years, 3 months ago by siestajoye.
August 31, 2014 at 4:26 am #311427Hi!
Using the plugin I mentioned above is by far the best option. Its ridiculously easy to edit and regenerate from the admin and since you need to install at least one plugin to regenerate thumbnails you might as well install the one that also lets you edit images.
This is even more valid in your case since you want to play around with sizes and this plugin lets you do that per image: http://wordpress.org/extend/plugins/simple-image-sizes/
Best regards,
Devin -
AuthorPosts
- You must be logged in to reply to this topic.