-
AuthorPosts
-
August 18, 2017 at 2:10 am #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 7 years, 3 months ago by scotthco.
August 18, 2017 at 10:16 pm #841051I 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
August 19, 2017 at 8:30 pm #841400Hi Scott,
Glad you got it working for you! :)
If you need further assistance please let us know.
Best regards,
Victoria -
AuthorPosts
- You must be logged in to reply to this topic.