PATH:
home
/
lab2454c
/
mact34.com
/
wp-content
/
plugins
/
tryo-toolkit
/
widgets
<?php /** * Blog Post Widget */ namespace Elementor; class Tryo_Blog_Post extends Widget_Base { public function get_name() { return 'TryoBlogPost'; } public function get_title() { return __( 'Blog Post', 'tryo-toolkit' ); } public function get_icon() { return 'eicon-posts-grid'; } public function get_categories() { return [ 'tryo-elements' ]; } protected function _register_controls() { $this->start_controls_section( 'blog_section', [ 'label' => __( 'Blog Post', 'tryo-toolkit' ), 'tab' => Controls_Manager::TAB_CONTENT, ] ); $this->add_control( 'columns', [ 'label' => __( 'Choose Columns', 'tryo-toolkit' ), 'type' => Controls_Manager::SELECT, 'options' => [ 2 => __( '2', 'tryo-toolkit' ), 3 => __( '3', 'tryo-toolkit' ), 4 => __( '4', 'tryo-toolkit' ), ], 'default' => 3, ] ); $this->add_control( 'cat_name', [ 'label' => __( 'Select Category', 'tryo-toolkit' ), 'type' => Controls_Manager::SELECT, 'options' => tryo_toolkit_get_post_cat_list(), ] ); $this->add_control( 'order', [ 'label' => __( 'Post Order By', 'tryo-toolkit' ), 'type' => Controls_Manager::SELECT, 'options' => [ 'DESC' => __( 'DESC', 'tryo-toolkit' ), 'ASC' => __( 'ASC', 'tryo-toolkit' ), ], 'default' => 'DESC', ] ); $this->add_control( 'count', [ 'label' => __( 'Post Per Page', 'tryo-toolkit' ), 'type' => Controls_Manager::NUMBER, 'default' => 3, ] ); $this->add_control( 'read_more_text', [ 'label' => __( 'Post Read More Text', 'tryo-toolkit' ), 'type' => Controls_Manager::TEXT, 'default' => __('Read More', 'tryo-toolkit'), ] ); $this->end_controls_section(); $this->start_controls_section( 'post_style', [ 'label' => __( 'Style', 'tryo-toolkit' ), 'tab' => Controls_Manager::TAB_STYLE, ] ); $this->add_control( 'title_color', [ 'label' => __( 'Title Color', 'tryo-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content h3 a' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'title_size', [ 'label' => __( 'Title Font Size', 'tryo-toolkit' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 40, 'step' => 1, ], ], 'devices' => [ 'desktop', 'tablet', 'mobile' ], 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content h3' => 'font-size: {{SIZE}}px;', ], ] ); $this->add_control( 'content_color', [ 'label' => __( 'Content Color', 'tryo-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content p' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'content_size', [ 'label' => __( 'Contents Font Size', 'tryo-toolkit' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 20, 'step' => 1, ], ], 'devices' => [ 'desktop', 'tablet', 'mobile' ], 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content p' => 'font-size: {{SIZE}}px;', ], ] ); $this->add_control( 'button_color', [ 'label' => __( 'Button Color', 'tryo-toolkit' ), 'type' => Controls_Manager::COLOR, 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content .read-more-btn' => 'color: {{VALUE}}', ], ] ); $this->add_responsive_control( 'button_size', [ 'label' => __( 'Button Font Size', 'tryo-toolkit' ), 'type' => Controls_Manager::SLIDER, 'size_units' => [ 'px' ], 'range' => [ 'px' => [ 'min' => 10, 'max' => 20, 'step' => 1, ], ], 'devices' => [ 'desktop', 'tablet', 'mobile' ], 'selectors' => [ '{{WRAPPER}} .single-blog-post .blog-post-content .read-more-btn' => 'font-size: {{SIZE}}px;', ], ] ); $this->end_controls_section(); } protected function render() { $settings = $this->get_settings_for_display(); global $tryo_opt; if( isset( $tryo_opt['enable_lazyloader'] ) ): $is_lazyloader = $tryo_opt['enable_lazyloader']; else: $is_lazyloader = true; endif; if( $is_lazyloader == true ): $lazy_class = 'smartify'; $lazy_attr = 'sm-'; else: $lazy_class = ''; $lazy_attr = ''; endif; $columns = $settings['columns']; if ($columns == 2) { $column = 'col-lg-6 col-md-6'; }elseif ($columns == 4) { $column = 'col-lg-3 col-md-6'; }else { $column = 'col-lg-4 col-md-6'; } if ($settings['cat_name'] != '') { $args = array( 'orderby' => 'date', 'order' => $settings['order'], 'posts_per_page' => $settings['count'], 'ignore_sticky_posts' => 1, 'meta_key' => '_thumbnail_id', 'tax_query' => array( array( 'taxonomy' => 'category', 'field' => 'slug', 'terms' => $settings['cat_name'], ) ) ); }else{ $args = array( 'orderby' => 'date', 'order' => $settings['order'], 'posts_per_page' => $settings['count'], 'ignore_sticky_posts' => 1, 'meta_key' => '_thumbnail_id' ); } $post_array = new \WP_Query( $args ); ?> <div class="container"> <div class="row"> <?php while($post_array->have_posts()): $post_array->the_post(); $excerpt = get_the_excerpt(); $excerpt = substr( $excerpt , 0, 119); ?> <div class="<?php echo esc_attr($column); ?>"> <div class="single-blog-post-box"> <div class="blog-image"> <a href="<?php the_permalink(); ?>"> <img class="<?php echo esc_attr($lazy_class); ?>" <?php echo esc_attr($lazy_attr); ?>src="<?php the_post_thumbnail_url( 'tryo_post_thumb' ); ?>" alt="<?php the_post_thumbnail_caption(); ?>"> </a> </div> <div class="blog-post-content"> <?php if( isset( $tryo_opt['is_post_meta'] ) && $tryo_opt['is_post_meta'] == true ) { ?> <ul class="entry-meta"> <li> <i class="far fa-user"></i> <a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ), get_the_author_meta( 'user_nicename' ) ) ); ?>"> <?php echo esc_html(get_the_author()); ?> </a> </li> <li> <i class="far fa-calendar"></i> <?php echo esc_html(get_the_date()); ?> </li> </ul> <?php } ?> <h3><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h3> <p><?php echo esc_html($excerpt); ?></p> <?php if( $settings['read_more_text'] != '' ): ?> <a href="<?php the_permalink(); ?>" class="btn btn-primary"> <?php echo esc_html( $settings['read_more_text'] ); ?> </a> <?php endif ?> </div> </div> </div> <?php endwhile; ?> <?php wp_reset_postdata(); ?> </div> </div> <?php } protected function _content_template() {} } Plugin::instance()->widgets_manager->register_widget_type( new Tryo_Blog_Post );
[-] banner-feature.php
[edit]
[-] profile-form.php
[edit]
[-] business-area.php
[edit]
[-] services-two.php
[edit]
[-] banner-two.php
[edit]
[-] signup.php
[edit]
[+]
..
[-] payment-experience-area.php
[edit]
[-] post.php
[edit]
[-] works.php
[edit]
[-] account-create.php
[edit]
[-] comparisons-table.php
[edit]
[-] partner-slider.php
[edit]
[-] app-download.php
[edit]
[-] feature-box.php
[edit]
[-] team.php
[edit]
[-] global-area.php
[edit]
[-] userinfo-details.php
[edit]
[-] banner-three.php
[edit]
[-] pricing.php
[edit]
[-] success-story-area.php
[edit]
[-] contact-card.php
[edit]
[-] contact-cta-box.php
[edit]
[-] services-area.php
[edit]
[-] ready-to-talk.php
[edit]
[-] section.php
[edit]
[-] receive-details.php
[edit]
[-] about-area.php
[edit]
[-] banner-four.php
[edit]
[-] send-details.php
[edit]
[-] support-area.php
[edit]
[-] invoicing.php
[edit]
[-] testimonials.php
[edit]
[-] funfact.php
[edit]
[-] signin.php
[edit]
[-] information-box.php
[edit]
[-] new-payment.php
[edit]
[-] banner-one.php
[edit]
[-] feedback-card.php
[edit]
[-] feature.php
[edit]