Tagged: child theme, CSS, layout, template
-
AuthorPosts
-
March 25, 2014 at 1:49 pm #242703
Hi
1. Child Theme
I installed and activated the Enfold Child Theme (http://bit.ly/enfold-child) with Enfold v 2.6.2 as the parent theme. In the child theme, I imported the parent theme’s settings – however, the entire site design & css breaks. Also, the child theme changes the selected menus which were set for the main navigation. Do you have a child theme compatible with the latest Enfold version?2. Changing the Layout of the Sidebar to 2 units
Also — what I am trying to achieve is to make the left side bar on pages smaller (*two* columns instead of *three*). So what I need to do is edit the template code so that the aside class says ‘two’ instead of ‘three’:<aside class="sidebar sidebar_left smartphones_sidebar_active three alpha units" role="complementary" itemscope="itemscope" itemtype="http://schema.org/WPSideBar">...</aside>
and change
<div class="template-page content nine units">...</div>
to say *ten* instead of *nine*.What is the best way to achieve this whilst maintaining compatibility with all future auto-updates?
- This topic was modified 10 years, 9 months ago by gorans. Reason: cleaning up formatting
March 26, 2014 at 10:44 am #243251Hi gorans!
1) Any child theme set up as a child of enfold is compatible though when importing in the parent theme settings you may need to tweak things a bit. At the very least go into the styling options and re-save your settings and then the same in your WordPress menus manager.
2) The functions.php has the settings for the layouts on lines 141-144. You can copy and past theme into your child theme to overwrite the data.
Regards,
DevinMarch 30, 2014 at 12:16 pm #245072Thanks Devin
1) worked — I had the redo the menus and now everything appears the same.
2) The layout override I’m having issues with. Because the Child functions.php is loaded before the parent’s file, it means that when I override the line:
$avia_config['layout']['sidebar_left'] = array('content' => 'nine', 'sidebar' => 'three alpha' ,'meta' => 'two alpha', 'entry' => 'nine');
to have my settings, it is again overwritten by the parent theme’s function.php.I don’t want to have to copy & paste all the functions.php file from the parent into the child because then any updates to the parent won’t go through to the child theme. Is there a nicer ‘DRY’ way to do this? Ideally the parent functions.php should check to determine if that variable is set before setting the defaults.
`
March 30, 2014 at 12:36 pm #245078By way of update. I figured out how to achieve item (2)
In the child theme’s function.php I added the following:
function change_sidebar_left_layout() { global $avia_config; $avia_config['layout']['sidebar_left'] = array('content' => 'ten', 'sidebar' => 'two alpha' ,'meta' => 'two alpha', 'entry' => 'eight'); }; add_action('init', 'change_sidebar_left_layout');
Please let me know if that is the correct way to do it.
Thanks
April 1, 2014 at 2:58 am #245830That is a great way to do it yes.
September 16, 2014 at 6:47 pm #320052Hi
I have the same issue.
Please could you elaborate on how you referenced ‘change_sidebar_left_layout’ and where?
Thanks!September 16, 2014 at 6:49 pm #320055Hi!
Please refer to Peter’s post here – https://kriesi.at/support/topic/right-sidebar-width/#post-118282
Cheers!
YigitSeptember 17, 2014 at 9:24 am #320383Hi Yigit
Many thanks – but I am referring to how best to amend the grid units in a child theme so that any update to the parent theme doesn’t lose the settings. Gorans answer seemed to have solved this with an addition to the child theme functions.php file – but I would like to know how that was implemented in the site itself.
Any thoughts on how that can be done?
Thanks againSeptember 18, 2014 at 5:50 am #320894Hey!
Goran’s code references grid units, it essentially modifies the global $avia_config variable when WordPress initializes (init hook):
function change_sidebar_left_layout() { global $avia_config; $avia_config['layout']['sidebar_left'] = array('content' => 'ten', 'sidebar' => 'two alpha' ,'meta' => 'two alpha', 'entry' => 'eight'); }; add_action('init', 'change_sidebar_left_layout');
You can extend it to affect right sidebars and/or fullsize layouts:
function change_sidebar_left_layout() { global $avia_config; $avia_config['layout']['sidebar_left'] = array('content' => 'ten', 'sidebar' => 'two alpha' ,'meta' => 'two alpha', 'entry' => 'eight'); $avia_config['layout']['sidebar_right'] = array('content' => 'ten', 'sidebar' => 'two alpha' ,'meta' => 'two alpha', 'entry' => 'eight'); $avia_config['layout']['fullsize'] = array('content' => 'twelve alpha', 'sidebar' => 'hidden', 'meta' => 'two alpha', 'entry' => 'eleven'); }; add_action('init', 'change_sidebar_left_layout');
Best regards,
JosueSeptember 18, 2014 at 9:46 am #321027Hi Josue
Many thanks for that explanation – it’s much appreciated, however adding this code in the child theme functions file adds some to the left of the content area (I only have a right sidebar). Is there a way around this please?
Thanks again
Chris- This reply was modified 10 years, 3 months ago by cbentley65.
September 18, 2014 at 7:42 pm #321430Hi Chris!
What code have you added? can you post a link to your website please?
Cheers!
JosueSeptember 18, 2014 at 8:51 pm #321478This reply has been marked as private.September 20, 2014 at 4:52 pm #322414Hi!
No that should work correctly. The child theme is active and other functions are working as well?
Best regards,
DevinSeptember 20, 2014 at 7:03 pm #322434Hi Devin
Thanks – yes, the child theme is active and the functions file is working OK in there….
Any thoughts?September 23, 2014 at 2:07 am #323401If this is on a live site please provide the admin credentials here as a private reply and we’ll take a look.
September 23, 2014 at 9:49 am #323557This reply has been marked as private.September 24, 2014 at 9:46 am #324119Hi!
Kriesi will remove this layout class system and replace it with a much more simple content / sidebar width system. For now, the sidebar code should be:
function change_sidebar_left_layout() { global $avia_config; $avia_config['layout']['fullsize'] = array('content' => 'twelve alpha', 'sidebar' => 'hidden', 'meta' => 'two alpha', 'entry' => 'eleven'); $avia_config['layout']['sidebar_left'] = array('content' => 'ten', 'sidebar' => 'two alpha' ,'meta' => 'one alpha', 'entry' => 'nine'); $avia_config['layout']['sidebar_right'] = array('content' => 'ten alpha', 'sidebar' => 'two alpha', 'meta' => 'one alpha', 'entry' => 'nine alpha'); } add_action( 'init', 'change_sidebar_left_layout', 1);
On Enfold 3.0, you can probably just use this on Quick CSS or custom.css to change the width of the content:
.container .av-content-small.units { width: 80%; }
Best regards,
IsmaelSeptember 25, 2014 at 12:39 pm #324904Hi Ismael
Many thanks – that works well!
ChrisHi Ismael – I think I spoke too soon – the content area is no longer responsive with this code in the functions file of the child theme, or with the amendment (ten, two) in the parent theme.
I tried the Custom CSS as well but that made no difference.
Can you assist please?
Thankd
Chris- This reply was modified 10 years, 3 months ago by cbentley65.
September 26, 2014 at 6:34 pm #325717For now I would suggest simply changing the parent functions.php if the child function isn’t working for you. I’ve not had any issues with it but the change would need to be re-done in the 3.0 update anyway so there is no difference in the short term to alter the parent directly in this case.
-
AuthorPosts
- You must be logged in to reply to this topic.