-
AuthorPosts
-
August 18, 2017 at 6:23 am #840748
Hello Hello :)
Love the theme, been using it for years now!
I have made a custom post type using the plugin Toolset Types (https://wp-types.com/) and I want to be able to use the Advanced Editor.
I have tried 3 solutions so far without success:
1) This code I found in the forums:
add_filter(‘avf_builder_boxes’, ‘avia_register_meta_boxes’, 10, 1); //Add meta boxes to custom post types function avia_register_meta_boxes($boxes) { if(!empty($boxes)) { foreach($boxes as $key => $box) { $boxes[$key][‘page’][] = ‘people’; $boxes[$key][‘page’][] = ‘places’; $boxes[$key][‘page’][] = ‘events’; $boxes[$key][‘page’][] = ‘stories’; } } return $boxes; }
2) This I found in the Enfold Documentation:
add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) { foreach($metabox as &$meta) { if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') { $meta['page'][] = 'course'; /*instead add the name of the custom post type here*/ } } return $metabox; }
3) And this I found on another forum post:
add_filter( 'avf_builder_boxes', 'enfold_customization_posts_builder' ); function enfold_customization_posts_builder( $b ){ $b[1]['page'] = array( 'course', 'courses' ); return $b; }
If someone wouldn’t mind logging in to the website on our testing server and having a look or providing me with a particular code snippet that would be super appreciated.
The post type is called ‘course’ (Courses) and you will see it in the back end under Pages.
August 18, 2017 at 1:45 pm #840861Hi,
I too have tried a few different snippets to do the same thing without success.
All the snippets are trying to write a rule adding the post type to the meta.php so the ALB will load.
You can do this manually which is how I got round the issue. Not ideal if you are unfamiliar with .php
None the less if you fancy a bash go to…
config-templatebuilder>avia-template-builder>config to find meta.phpThe code to alter is at the top and looks like…
$boxes = array( array( 'title' =>$av_default_title, 'id'=>'avia_builder', 'page'=>array('post','portfolio','page', 'course'), 'context'=>'normal', 'priority'=>'high', 'expandable'=>true ), array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page' , 'post', 'course'), 'context'=>'side', 'priority'=>'low'), array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio', 'course'), 'context'=>'normal', 'priority'=>'high' ), array( 'title' =>__('Breadcrumb Hierarchy','avia_framework' ), 'id'=>'hierarchy', 'page'=>array('portfolio', 'charity', 'publications', 'our_events', 'partners'), 'context'=>'side', 'priority'=>'low'), ); $boxes = apply_filters('avf_builder_boxes', $boxes);
Add course to the top three arrays. That should set the ALB and all portfolio options to work with your CPT.
Not the best solution but it works
TJ
August 21, 2017 at 12:50 am #841798Hi thanks for the suggestion. I have changed the code as you have outlined but it doesn’t seem to have worked….
$boxes = array( array( 'title' =>$av_default_title, 'id'=>'avia_builder', 'page'=>array('post','portfolio','page','product', 'course'), 'context'=>'normal', 'priority'=>'high', 'expandable'=>true ), array( 'title' =>__('Layout','avia_framework' ), 'id'=>'layout', 'page'=>array('portfolio', 'page' , 'post', 'course'), 'context'=>'side', 'priority'=>'low'), array( 'title' =>__('Additional Portfolio Settings','avia_framework' ), 'id'=>'preview', 'page'=>array('portfolio', 'course'), 'context'=>'normal', 'priority'=>'high' ), array( 'title' =>__('Breadcrumb Hierarchy','avia_framework' ), 'id'=>'hierarchy', 'page'=>array('portfolio'), 'context'=>'side', 'priority'=>'low'), ); $boxes = apply_filters('avf_builder_boxes', $boxes);
Still not seeing the Advanced Editor in my new post type :(
Did I do it wrong?Here is how the post type is configured in the plugin I used:
Link to screenshot: Screenshot
August 21, 2017 at 5:14 pm #842105Only thing i can think of is maybe try first-aid-courses rather than course.
I don’t know how the plug in in question handles the creation of post types but generally the slug is the post type name and used in queries.
That may even make your original code work correctly.Worth a shot
TJ
August 22, 2017 at 12:35 am #842271Oh! Fantastic I will try that. Thank you, I am not so great with post type customisation and what not.
I will do this today and let you know how it went.August 22, 2017 at 12:40 am #842273OK SO:
The documentation code and using ‘first-aid-courses’ did the trick!
add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) { foreach($metabox as &$meta) { if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') { $meta['page'][] = 'first-aid-courses'; /*instead add the name of the custom post type here*/ } } return $metabox; }
Thanks for your help! You can close this ticket.
August 22, 2017 at 6:10 am #842318June 4, 2019 at 12:06 pm #1107033Hi!
NOTE: Starting on version 4.3, the “avf_builder_boxes” has to be replaced with the “avf_alb_supported_post_types” filter in order to register your custom post types and enable the advance layout builder. More info in the documentation.
// https://kriesi.at/documentation/enfold/intro-to-layout-builder/#alb-for-any-post-type
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.