Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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.

    #840861

    Hi,

    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.php

    The 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

    #841798

    Hi 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:

    Screenshot of post tyoe set up using Toolset Types

    Link to screenshot: Screenshot

    #842105

    Only 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

    #842271

    Oh! 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.

    #842273

    OK 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.

    #842318

    Hi,

    Awesome! Let us know if you need anything else.

    Thanks @tjswarbs78!

    Best regards,
    Ismael

    #1107033

    Hi!

    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

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.