-
AuthorPosts
-
November 22, 2019 at 6:52 pm #1159284
I have researched this and tried many different variations of code that I got from the forums here in my functions.php. file.
I am using LearnDash LMS and need to have the option to select no sidebars and no related content or sharaholic mentions at the bottom of all the “posts” whether they be courses, modules, or lessons.
Natively, in LearnDash they are structured and called/considered courses – lessons – topics (but I changed the title of lessons to modules, and topics to lessons in the settings, not sure if that matters).Anyway, right now I have the advanced layout options available to me for creating new modules, but nothing else.
I’ll post some varieties of code I tried. Most recent is the latest recommendation from the Enfold documentations (not working):function avf_alb_supported_post_types_mod( array $supported_post_types ) { $supported_post_types[] = 'sfwd-courses'; $supported_post_types[] = 'sfwd-lessons'; $supported_post_types[] = 'sfwd-topic'; $supported_post_types[] = 'sfwd-quiz'; return $supported_post_types; } add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1); function avf_metabox_layout_post_types_mod( array $supported_post_types ) { $supported_post_types[] = 'sfwd-courses'; $supported_post_types[] = 'sfwd-lessons'; $supported_post_types[] = 'sfwd-topic'; $supported_post_types[] = 'sfwd-quiz'; return $supported_post_types; } add_filter('avf_metabox_layout_post_types', 'avf_metabox_layout_post_types_mod', 10, 1);
Here’s something else I tried:
/* * Add Advanced Layout Editor to LearnDash Custom Post Types */ //Add meta boxes to custom post types add_filter('avf_builder_boxes', 'avia_register_meta_boxes', 10, 1); function avia_register_meta_boxes($boxes) { if(!empty($boxes)) { foreach($boxes as $key => $box) { $boxes[$key]['page'][] = 'sfwd-courses'; $boxes[$key]['page'][] = 'sfwd-lessons'; $boxes[$key]['page'][] = 'sfwd-topic'; $boxes[$key]['page'][] = 'sfwd-quiz'; } } return $boxes; }
Another one:
add_filter('avf_builder_boxes', 'add_builder_to_posttype'); function add_builder_to_posttype($metabox) { $post_types = array('sfwd-courses', 'sfwd-lessons', 'sfwd-quiz', 'sfwd-topic', 'sfwd-certificates' ); foreach($metabox as &$meta) { if($meta['id'] == 'avia_builder' || $meta['id'] == 'layout') { foreach ($post_types as $post_type){ $meta['page'][] = $post_type; } } } return $metabox; }
Another one:
/* Adds PageBuilder to LearnDash 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'][] = 'sfwd-courses'; $meta['page'][] = 'sfwd-lessons'; $meta['page'][] = 'sfwd-topic'; } } return $metabox; }
Any suggestions? I am really coming down to the wire on my deadline for things, help is so appreciated!
November 24, 2019 at 11:01 pm #1159706Hello Team, just folloiwng up to let you know I have resolved this issue. We can close this ticket.
Thanks!November 26, 2019 at 11:33 am #1160262 -
AuthorPosts
- The topic ‘URGENT – Need Layout Builder for All Post Types (code not working)’ is closed to new replies.