learnpress
/
inc
/
ExternalPlugin
/
Elementor
/
Widgets
/
Course
/
Dynamic
/
CourseAuthorUrlElementor.php
CourseAuthorUrlElementor.php in LearnPress – WordPress LMS Plugin for Create and Sell Online Courses 4.3.8, at inc/ExternalPlugin/Elementor/Widgets/Course/Dynamic/CourseAuthorUrlElementor.php
| 1 | <?php |
| 2 | /** |
| 3 | * Class CourseAuthorUrlElementor |
| 4 | * |
| 5 | * Dynamic course author url elementor. |
| 6 | * |
| 7 | * @since 4.2.3.5 |
| 8 | * @version 1.0.0 |
| 9 | */ |
| 10 | namespace LearnPress\ExternalPlugin\Elementor\Widgets\Course\Dynamic; |
| 11 | use Elementor\Core\DynamicTags\Tag; |
| 12 | use LearnPress\ExternalPlugin\Elementor\LPDynamicElementor; |
| 13 | use LearnPress\TemplateHooks\Instructor\SingleInstructorTemplate; |
| 14 | use Elementor\Modules\DynamicTags\Module; |
| 15 | |
| 16 | defined( 'ABSPATH' ) || exit; |
| 17 | |
| 18 | class CourseAuthorUrlElementor extends Tag { |
| 19 | use LPDynamicElementor; |
| 20 | |
| 21 | public function __construct( array $data = [] ) { |
| 22 | $this->lp_dynamic_title = 'Course Author Url'; |
| 23 | $this->lp_dynamic_name = 'course-author-url'; |
| 24 | $this->lp_dynamic_categories = [ Module::URL_CATEGORY ]; |
| 25 | parent::__construct( $data ); |
| 26 | } |
| 27 | |
| 28 | /** |
| 29 | * Render dynamic course author url elementor. |
| 30 | * |
| 31 | * @return void |
| 32 | */ |
| 33 | public function render() { |
| 34 | try { |
| 35 | $course = $this->get_course_model(); |
| 36 | if ( ! $course ) { |
| 37 | return; |
| 38 | } |
| 39 | |
| 40 | $author = $course->get_author_model(); |
| 41 | if ( ! $author ) { |
| 42 | return; |
| 43 | } |
| 44 | echo $author->get_url_instructor(); |
| 45 | } catch ( \Throwable $e ) { |
| 46 | error_log( $e->getMessage() ); |
| 47 | } |
| 48 | } |
| 49 | } |
| 50 |