LLMS_Shortcode_Course_Element::get_output()
Retrieve the actual content of the shortcode
Description Description
$atts & $content are both filtered before being passed to get_output() output is filtered so the return of get_output() doesn’t need its own filter
Return Return
(string)
Source Source
File: includes/abstracts/abstract.llms.shortcode.course.element.php
protected function get_output() { // get a reference to the current page where the shortcode is displayed global $post; $current_post = $post; $course = get_post( $this->get_attribute( 'course_id' ) ); // we don't have a post object to proceed with if ( ! $course ) { return ''; } if ( 'course' !== $course->post_type ) { // get the parent $parent = llms_get_post_parent_course( $course ); // post type doesn't have a parent so we can't display a syllabus if ( ! $parent ) { return ''; } // we have a course $course = $parent->post; } ob_start(); // hack the global so our syllabus template works if ( $course->ID != $current_post->ID ) { $post = $course; } $this->template_function(); // restore the global if ( $course->ID != $current_post->ID ) { $post = $current_post; } return ob_get_clean(); }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
3.6.0 | Introduced. |
User Contributed Notes User Contributed Notes
Permalink: