-
AuthorPosts
-
October 18, 2022 at 9:28 pm #1369288
Hi there,
I’m using the LMS plugin WP Courseware in one project on a multi-author Enfold blog configuration. This particular LMS has been chosen for very specific reasons and works very well with Enfold so far.WP Courseware organizes courses into “modules” which are basically modified special “archived posts” as I understand it and “units” which are modified blog entries.
One issue is that neither WP Courseware modules nor units allow for displaying “author” and “layout” through the screen options selection of WordPress. It seems to me this might be because Enfold does not recognize these modules and units in the way it recognizes blog posts.
Is there any way these two options can be made visible. Especially the “author” option would be urgently needed and highly appreciated. As super user I need to create the general structure for various courses of different authors. However, in that way, the super user will be visible as course author and even unit author, since the author profile picture is shown on every unit, like it is supposed to based on the multi-author blog setting. At present I need to change accounts whenever I need to create a new course structure and units for the courses. It’ll be much easier if the “author” field could be used to change authorship after creation.
Similar issue for the missing “layout” option with respect to sidebar usage. It is less problematic, since I can arrange somehow with global “blog sidebar” settings, but it is sub-optimal in displaying module pages in my case … This problem has been discussed before in the forum, but no solution as far as I could see.
Suggestions on how to activate these screen options for modules and units are appreciated very much.
Michael- This topic was modified 2 years, 1 month ago by MichaelNickel. Reason: added additional tags for clarity
October 20, 2022 at 4:35 am #1369529Hey MichaelNickel,
Thank you for the inquiry.
One issue is that neither WP Courseware modules nor units allow for displaying “author” and “layout” through the screen options selection of WordPress. It seems to me this might be because Enfold does not recognize these modules and units in the way it recognizes blog posts.
Units are actually custom posts from a custom post type, and they have to support authors and layouts before you can enable them from the screen options. Unfortunately, we are not sure if the authors added support for or enabled these features when they registered the post type.
// https://developer.wordpress.org/reference/functions/register_post_type/
For the layout metabox, you can add this code in the functions.php file.
function avf_alb_supported_post_types_mod( array $supported_post_types ) { $supported_post_types[] = 'course_unit'; 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[] = 'course_unit'; return $supported_post_types; } add_filter('avf_metabox_layout_post_types', 'avf_metabox_layout_post_types_mod', 10, 1);
We may need to access one of the course unit in order to check if the we used the correct custom post type slug or name in the filters above. Please provide the link in the private field.
Best regards,
IsmaelOctober 20, 2022 at 9:44 am #1369547Hi Ismael,
thank you for your quick reply and the solution for the layout box. It perfectly works! Thank you so much. Now I am able to assign a custom sidebar for courses only. That’s what I needed.With respect to the “author box”: Isn’t a similar solution through functions.php possible for the author box? Even if you don’t support third party plugins, it’s still an Enfold issue. Enfold shows the author profile picture on each blog post. So it does for the course units. The issue is that even if the Admin is only adding one course unit to a course (that has been created through the correct course author account), that single unit will show the admin profile picture …
I’m in contact with WP Courseware Support and I hope they can add support for author box and changing author in quick edit mode for courses, modules and units, if there is no fix through functions.php.
Thank you very much again
Best
MichaelOctober 21, 2022 at 5:09 pm #1369746Hi Ismael,
I was running an experiment to adapt your code also for LearnDash post types, since started cross-testing both LMS systems to see what suits this project better.
It actually works for whatever post type by simply adding an extra line of $supported_post_types[] at both occurances for each post type:
$supported_post_types[] = 'post type';
Great! thank you again.
Next big question in this context is: Would it also be possible to add AVIA advanced layout edit functionailty to those post types, too?
I found (on the Learndash site) a code dating back to 2015 which obviosly worked back then, but does not make a difference in my current installation:
Code reads:
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; }
Do you have a solution that works with the current Enfold version?
Thank you and best
MichaelOctober 28, 2022 at 10:39 am #1370531Hi,
Next big question in this context is: Would it also be possible to add AVIA advanced layout edit functionailty to those post types, too?
Sorry for the late response. You can use the avf_alb_supported_post_types filter, which we provided above. The filter will enable the Advance Layout Builder for different post types. Please note that enabling the builder for these post type has its own limitations. Some features of the plugin may not work as expected when the builder is active.
function avf_alb_supported_post_types_mod( array $supported_post_types ) { $supported_post_types[] = 'course_unit'; $supported_post_types[] = 'another_post_type'; $supported_post_types[] = 'and_another'; return $supported_post_types; } add_filter('avf_alb_supported_post_types', 'avf_alb_supported_post_types_mod', 10, 1);
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.