Tagged: child theme
-
AuthorPosts
-
January 7, 2015 at 12:36 am #375936
Hi
I try to create a child theme “the right way”.
That is easy as long I have only style.css and functions.php in the child folder.
But I made changes to config-template-builder/avia-template-builder/config/meta.php to activate the avia template builder in custom post types.
As long I have the changes in the theme files all works fine, but as soon the meta.php is in the child folder it’s no longer working.
I made the same folder hierarchy as the theme files have: config-template-builder/avia-template-builder/config/meta.php
I also tried to have meta.php just in the child theme folder, but nothing is working.Wordpress Codex says:
Overriding theme files
Yet another way of altering the parent theme via a child theme is by overriding actual theme files. And that’s very easy to do: except for functions.php, most other files that you place in your child theme and have the same name as ones in your parent theme, override them and WordPress will only use the ones in your child theme. The usual ones are: header.php, footer.php, page.php, post.php, comment.php, category.php, content[-*].php.For example let’s say you want to edit something inside header.php. Copy that file from your parent theme and place it in your child theme. You can now edit it here and get it to fit your every need. The parent theme will still have the original in case you get something wrong, and you are free to edit the one in your child theme in any way. This way you can easily edit important files like header.php, footer.php, page templates etc.
But this to good to be true – it is not working for me so far…
Do we need some code in the child theme’s functions.php to get this working?Thanks for your help
Peter- This topic was modified 9 years, 10 months ago by pegasso4444.
January 7, 2015 at 9:10 pm #376445Hi pegasso4444!
That’s not a template file so you cannot drag it to a child theme. Instead add this to your child theme functions.php file.
add_filter( 'avf_builder_boxes', 'enfold_customization_posts_builder' ); function enfold_customization_posts_builder( $b ){ $b[0]['page'] = array( 'portfolio', 'page', 'post' ); return $b; }
Best regards,
ElliottJanuary 8, 2015 at 7:06 pm #377012Hi Elliott,
Unfortunately this filter is not working for my custom post types.
In meta.php I included several CPT like artists, projects, archives, videos, exhibitions, prints, publications, works, clients, photographers and news and they work fine as long meta is in the enfold folder.=======================================================================
enfold/config-template-builder/avia-template-builder/config/meta.php
Line 4 -9 change to activate builder in custom post types:
======================================================================
$boxes = array(
array( ‘title’ =>__(‘Avia Layout Builder’,’avia_framework’ ), ‘id’=>’avia_builder’, ‘page’=>array(‘portfolio’,’page’,’post’,’artists’,’projects’,’archives’,’videos’,’exhibitions’,’prints’,’publications’,’works’,’clients’,’photographs’,’news’), ‘context’=>’normal’, ‘priority’=>’high’, ‘expandable’=>true ),
array( ‘title’ =>__(‘Layout’,’avia_framework’ ), ‘id’=>’layout’, ‘page’=>array(‘portfolio’,’page’,’post’,’artists’,’projects’,’archives’,’videos’,’exhibitions’,’prints’,’publications’,’works’,’clients’,’photographs’,’news’), ‘context’=>’side’, ‘priority’=>’low’),
array( ‘title’ =>__(‘Additional Portfolio Settings’,’avia_framework’ ), ‘id’=>’preview’, ‘page’=>array(‘portfolio’), ‘context’=>’normal’, ‘priority’=>’high’ ),
array( ‘title’ =>__(‘Breadcrumb Hierarchy’,’avia_framework’ ), ‘id’=>’hierarchy’, ‘page’=>array(‘portfolio’), ‘context’=>’side’, ‘priority’=>’low’),
);How must the filter be for does CPT ?
Thank you for your help
PeterJanuary 9, 2015 at 12:11 am #377140Hey!
Sorry, the first element in the array is the layout builder. The meta options are the second element so it should be $b[1] instead of $b[0].
add_filter( 'avf_builder_boxes', 'enfold_customization_posts_builder' ); function enfold_customization_posts_builder( $b ){ $b[1]['page'] = array( 'portfolio', 'page', 'post', 'article', 'books', 'etc' ); return $b; }
And don’t forget to add your CPT slugs to the array.
Cheers!
ElliottJanuary 9, 2015 at 9:50 am #377283Hey Elliott!
Great – Thank you for that support.
Cheers
Peter -
AuthorPosts
- The topic ‘OVERRIDING THEME FILES IN CHILD THEME NOT WORKING’ is closed to new replies.