Warning: This method has been deprecated. There is not a replacement instead.
LLMS_Post_Handler::create_section( int $course_id, string $title = '' )
Creates a new Section
Parameters Parameters
- $course_id
-
(int) (Required) The parent course id.
- $title
-
(string) (Optional) An optional title for the section.
Default value: ''
Return Return
(int) Post id of the section.
Source Source
File: includes/class.llms.post.handler.php
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 | public static function create_section( $course_id , $title = '' ) { llms_deprecated_function( __METHOD__ , '5.7.0' ); // No course id? no new section!. if ( ! isset( $course_id ) ) { return ; } // Set the section_order variable. // Get the count of sections in the course and add 1. $course = new LLMS_Course( $course_id ); $sections = $course ->get_sections( 'posts' ); $section_order = count ( $sections ) + 1; $title = isset( $title ) ? $title : 'New Section' ; $post_id = self::create( 'section' , $title ); // If post created set parent course and order to order determined above. if ( $post_id ) { update_post_meta( $post_id , '_llms_order' , $section_order ); $section = new LLMS_Section( $post_id ); $updated_parent_course = $section ->set_parent_course( $course_id ); } return $post_id ; } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
5.7.0 | There is not a replacement. |
Unknown Introduced. | Introduced. |