Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #840703

    Hi Everyone!

    I already have the following code in my child theme’s functions.php file, which allow me to use the Advanced Layout Editor with custom post types.

    /* Add ALE to custom post types */
    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'][] = 'astcpt_product_off';
          $meta['page'][] = 'astcpt_partner';
          $meta['page'][] = 'astcpt_testimonial';
        }
      }
      return $metabox;
    }

    I would like to be able to use the Portfolio Grid with custom post types as well by using the following code. HOWEVER since part of the code below also enables use of the ALE with CPTs, I’m afraid the code above and below may conflict with each other and cause problems. Any suggestions for how to remedy that?

    /* to support displaying custom post types */
    add_theme_support(‘add_avia_builder_post_type_option’);
    add_theme_support(‘avia_template_builder_custom_post_type_grid’);
    
    /* to display advanced portfolio setting */
    add_filter(‘avf_builder_boxes’,’enable_boxes_on_posts’);
    function enable_boxes_on_posts($boxes) {
    $boxes[] = array( ‘title’ =>__(‘Avia Layout Builder’,’avia_framework’ ), ‘id’=>’avia_builder’, ‘page’=>array(‘portfolio’, ‘page’, ‘post’,’other-post-type’), ‘context’=>’normal’, ‘expandable’=>true );
    $boxes[] = array( ‘title’ =>__(‘Layout’,’avia_framework’ ), ‘id’=>’layout’, ‘page’=>array(‘portfolio’, ‘page’, ‘post’, ‘other-post-type’), ‘context’=>’side’, ‘priority’=>’low’);
    $boxes[] = array( ‘title’ =>__(‘Additional Portfolio Settings’,’avia_framework’ ), ‘id’=>’preview’, ‘page’=>array(‘portfolio’, ‘other-post-type’), ‘context’=>’normal’, ‘priority’=>’high’ );
    
    return $boxes;
    }

    Thanks!

    Scott

    • This topic was modified 6 years, 10 months ago by scotthco.
    #841051

    I got this! ;-)

    I commented the entire first section since its functionality is included in the second. Then in the second section, I adjusted the first two $boxes[]… lines to accommodate the three CPTs from the first, and changed “other_post_type” in the third $boxes[]… line to “astcpt_partner”, the CPT I wanted to use with portfolios.

    Thanks!

    Scott

    #841400

    Hi Scott,

    Glad you got it working for you! :)

    If you need further assistance please let us know.

    Best regards,
    Victoria

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