llms_get_post_content( string $content )
Post Template Include
Description Description
Adds LifterLMS template content before and after the post’s default content.
Parameters Parameters
- $content
-
(string) (Required) WP_Post post_content.
Return Return
(string)
Source Source
File: includes/functions/llms-functions-content.php
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 | function llms_get_post_content( $content ) { global $post ; if ( ! $post instanceof WP_Post ) { return $content ; } $restrictions = llms_page_restricted( $post ->ID ); if ( in_array( $post ->post_type, array ( 'course' , 'llms_membership' , 'lesson' , 'llms_quiz' ), true ) ) { $post_type = str_replace ( 'llms_' , '' , $post ->post_type ); $template_before = 'single-' . $post_type . '-before' ; $template_after = 'single-' . $post_type . '-after' ; if ( $restrictions [ 'is_restricted' ] ) { $content = llms_get_post_sales_page_content( $post , $content ); if ( in_array( $post ->post_type, array ( 'lesson' , 'llms_quiz' ), true ) ) { $content = '' ; $template_before = 'no-access-before' ; $template_after = 'no-access-after' ; } } ob_start(); load_template( llms_get_template_part_contents( 'content' , $template_before ), false ); $before = ob_get_clean(); ob_start(); load_template( llms_get_template_part_contents( 'content' , $template_after ), false ); $after = ob_get_clean(); $content = do_shortcode( $before . $content . $after ); } /** * Filter the post_content of a LifterLMS post type. * * @since Unknown * * @param string $content Post content. * @param WP_Post $post Post object. * @param array $restrictions Result from `llms_page_restricted()` for the current post. */ return apply_filters( 'llms_get_post_content' , $content , $post , $restrictions ); } |
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.17.0 | Refactored. |
3.25.2 | Unknown. |
1.0.0 | Introduced. |