Conditions | 6 |
Paths | 5 |
Total Lines | 22 |
Code Lines | 11 |
Lines | 0 |
Ratio | 0 % |
Changes | 0 |
1 | <?php |
||
19 | public static function get_post_description( $post ) { |
||
20 | if ( empty( $post ) ) { |
||
21 | return ''; |
||
22 | } |
||
23 | |||
24 | if ( post_password_required() || ! is_singular() ) { |
||
25 | return ''; |
||
26 | } |
||
27 | |||
28 | // Business users can overwrite the description |
||
29 | $custom_description = self::get_post_custom_description( $post ); |
||
30 | |||
31 | if ( ! empty( $custom_description ) ) { |
||
32 | return $custom_description; |
||
33 | } |
||
34 | |||
35 | if ( ! empty( $post->post_excerpt ) ) { |
||
36 | return $post->post_excerpt; |
||
37 | } |
||
38 | |||
39 | return $post->post_content; |
||
40 | } |
||
41 | |||
64 |