| @@ -29,10 +29,10 @@ | ||
| 29 | 29 | 'recent_courses' => __CLASS__ . '::recent_courses', |
| 30 | 30 | 'featured_courses' => __CLASS__ . '::featured_courses', |
| 31 | 31 | 'popular_courses' => __CLASS__ . '::popular_courses', |
| 32 | 32 | //'button_enroll' => __CLASS__ . '::button_enroll', |
| 33 | - 'button_purchase' => __CLASS__ . '::button_purchase', | |
| 34 | - 'button_course' => __CLASS__ . '::button_course', | |
| 33 | + //'button_purchase' => __CLASS__ . '::button_purchase', | |
| 34 | + //'button_course' => __CLASS__ . '::button_course', | |
| 35 | 35 | 'course_curriculum' => __CLASS__ . '::course_curriculum', |
| 36 | 36 | ); |
| 37 | 37 | |
| 38 | 38 | foreach ( $shortcodes as $shortcode => $function ) { |
| @@ -56,16 +56,34 @@ | ||
| 56 | 56 | if ( ! $post ) { |
| 57 | 57 | return $template; |
| 58 | 58 | } |
| 59 | 59 | |
| 60 | - if ( $post->ID == learn_press_get_page_id( 'checkout' ) ) { | |
| 61 | - if ( ! preg_match( '/\[learn_press_checkout\s?(.*)\]/', $post->post_content ) ) { | |
| 60 | + // Option enable auto add shortcode. @since 4.2.3 | |
| 61 | + $enable = apply_filters( 'learn-press/auto-shortcode', true, $post ); | |
| 62 | + if ( ! $enable ) { | |
| 63 | + return $template; | |
| 64 | + } | |
| 65 | + | |
| 66 | + if ( LP_Page_Controller::is_page_checkout() ) { | |
| 67 | + if ( ! preg_match( '/\[learn_press_checkout\s?(.*)/', $post->post_content ) ) { | |
| 62 | 68 | $post->post_content .= '[learn_press_checkout]'; |
| 63 | 69 | } |
| 64 | 70 | } elseif ( $post->ID == learn_press_get_page_id( 'become_a_teacher' ) ) { |
| 65 | - if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)\]/', $post->post_content ) ) { | |
| 71 | + if ( ! preg_match( '/\[learn_press_become_teacher_form\s?(.*)/', $post->post_content ) ) { | |
| 66 | 72 | $post->post_content .= '[learn_press_become_teacher_form]'; |
| 67 | 73 | } |
| 74 | + } elseif ( LP_Page_Controller::is_page_profile() ) { | |
| 75 | + if ( ! preg_match( '/\[learn_press_profile\s?(.*)/', $post->post_content ) ) { | |
| 76 | + $post->post_content .= '[learn_press_profile]'; | |
| 77 | + } | |
| 78 | + } elseif ( LP_Page_Controller::is_page_instructor() ) { | |
| 79 | + if ( ! preg_match( '/\[learn_press_single_instructor\s?(.*)/', $post->post_content ) ) { | |
| 80 | + // $post->post_content .= '[learn_press_single_instructor]'; | |
| 81 | + } | |
| 82 | + } elseif ( LP_Page_Controller::is_page_instructors() ) { | |
| 83 | + if ( ! preg_match( '/\[learn_press_instructors\s?(.*)/', $post->post_content ) ) { | |
| 84 | + $post->post_content .= '[learn_press_instructors]'; | |
| 85 | + } | |
| 68 | 86 | } |
| 69 | 87 | |
| 70 | 88 | return $template; |
| 71 | 89 | } |
| @@ -230,11 +248,11 @@ | ||
| 230 | 248 | * @param string $content |
| 231 | 249 | * |
| 232 | 250 | * @return LP_Shortcode_Button_Purchase |
| 233 | 251 | */ |
| 234 | - public static function button_purchase( $atts, $content = '' ) { | |
| 252 | + /*public static function button_purchase( $atts, $content = '' ) { | |
| 235 | 253 | return new LP_Shortcode_Button_Purchase( $atts ); |
| 236 | - } | |
| 254 | + }*/ | |
| 237 | 255 | |
| 238 | 256 | /** |
| 239 | 257 | * @param $atts |
| 240 | 258 | * @param string $content |
| @@ -240,11 +258,11 @@ | ||
| 240 | 258 | * @param string $content |
| 241 | 259 | * |
| 242 | 260 | * @return LP_Shortcode_Button_Course |
| 243 | 261 | */ |
| 244 | - public static function button_course( $atts, $content = '' ) { | |
| 262 | + /*public static function button_course( $atts, $content = '' ) { | |
| 245 | 263 | return new LP_Shortcode_Button_Course( $atts ); |
| 246 | - } | |
| 264 | + }*/ | |
| 247 | 265 | |
| 248 | 266 | /** |
| 249 | 267 | * @param array $atts |
| 250 | 268 | * @param string $content |