PluginProbe
HT Builder – WordPress Theme Builder for Elementor / 1.2.4
HT Builder – WordPress Theme Builder for Elementor v1.2.4
1.3.5 1.3.4 trunk 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.8 1.0.9 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 1.3.2 1.3.3
ht-builder / includes / widgets / bl_post_content.php

bl_post_content.php in HT Builder – WordPress Theme Builder for Elementor 1.2.4, at includes/widgets/bl_post_content.php

136 lines 4.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace HT_Builder\Elementor\Widget;
3
4 // Elementor Classes
5 use Elementor\Plugin as Elementor;
6 use Elementor\Widget_Base;
7 use Elementor\Controls_Manager;
8 use Elementor\Group_Control_Border;
9 use Elementor\Group_Control_Box_Shadow;
10 use Elementor\Group_Control_Text_Shadow;
11 use Elementor\Group_Control_Typography;
12
13 if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly
14
15 class Bl_Post_Content_ELement extends Widget_Base {
16
17 public function get_name() {
18 return 'bl-post-content';
19 }
20
21 public function get_title() {
22 return __( 'BL: Post Content', 'ht-builder' );
23 }
24
25 public function get_icon() {
26 return 'htbuilder-icon eicon-post-content';
27 }
28
29 public function get_categories() {
30 return ['ht_builder'];
31 }
32
33 protected function register_controls() {
34
35
36 // Style
37 $this->start_controls_section(
38 'post_content_style_section',
39 array(
40 'label' => __( 'Post Content', 'ht-builder' ),
41 'tab' => Controls_Manager::TAB_STYLE,
42 )
43 );
44
45 $this->add_control(
46 'post_content_color',
47 [
48 'label' => __( 'Color', 'ht-builder' ),
49 'type' => Controls_Manager::COLOR,
50 'selectors' => [
51 '{{WRAPPER}}' => 'color: {{VALUE}};',
52 ],
53 ]
54 );
55
56 $this->add_group_control(
57 Group_Control_Typography::get_type(),
58 array(
59 'name' => 'post_content_typography',
60 'label' => __( 'Typography', 'ht-builder' ),
61 'selector' => '{{WRAPPER}}',
62 )
63 );
64
65 $this->add_responsive_control(
66 'post_contnet_align',
67 [
68 'label' => __( 'Alignment', 'ht-builder' ),
69 'type' => Controls_Manager::CHOOSE,
70 'options' => [
71 'left' => [
72 'title' => __( 'Left', 'ht-builder' ),
73 'icon' => 'fa fa-align-left',
74 ],
75 'center' => [
76 'title' => __( 'Center', 'ht-builder' ),
77 'icon' => 'fa fa-align-center',
78 ],
79 'right' => [
80 'title' => __( 'Right', 'ht-builder' ),
81 'icon' => 'fa fa-align-right',
82 ],
83 'justify' => [
84 'title' => __( 'Justified', 'ht-builder' ),
85 'icon' => 'fa fa-align-justify',
86 ],
87 ],
88 'prefix_class' => 'elementor-align-%s',
89 'default' => 'left',
90 ]
91 );
92
93 $this->end_controls_section();
94
95 }
96
97 protected function render( $instance = [] ) {
98
99 static $have_posts = [];
100 $post = get_post();
101
102 if( Elementor::instance()->editor->is_edit_mode() ){
103 echo '<h3>' . __('Post Content', 'ht-builder' ). '</h3>';
104 }else{
105
106 if ( post_password_required( $post->ID ) ) {
107 echo get_the_password_form( $post->ID );
108 return;
109 }
110
111 // Avoid editor recursion
112 if ( isset( $have_posts[ $post->ID ] ) ) { return; }
113 $have_posts[ $post->ID ] = true;
114 // End avoid editor recursion
115
116 if( Elementor::$instance->db->is_built_with_elementor( $post->ID ) ){
117 echo Elementor::instance()->frontend->get_builder_content( $post->ID, true );
118 }else{
119 echo apply_filters( 'the_content', get_the_content() );
120 wp_link_pages( [
121 'before' => '<div class="page-links"><span class="page-links-title elementor-page-links-title">' . __( 'Pages:', 'ht-builder' ) . '</span>',
122 'after' => '</div>',
123 'link_before' => '<span>',
124 'link_after' => '</span>',
125 'pagelink' => '<span class="screen-reader-text">' . __( 'Page', 'ht-builder' ) . ' </span>%',
126 'separator' => '<span class="screen-reader-text">, </span>',
127 ] );
128 }
129
130 }
131 }
132
133
134
135 }
136