HEX
Server: Apache
System: Linux p3plzcpnl507484.prod.phx3.secureserver.net 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: tvypkwena2lu (5224663)
PHP: 7.2.34
Disabled: NONE
Upload Files
File: /home/tvypkwena2lu/public_html/wp-content/plugins/widgets/gvs-testimonial.php
<?php
/**
 * Elementor oEmbed Widget.
 *
 * Elementor widget that inserts an embbedable content into the page, from any given URL.
 *
 * @since 1.0.0
 */
class Elementor_GVSTestimonial_Widget extends \Elementor\Widget_Base {

	public function get_name() {
		return 'gvs_testimonial';
	}

	public function get_title() {
		return __( 'Theme Testimonial', 'plugin-name' );
	}

	public function get_icon() {
		return 'fa fa-code';
	}

	public function get_categories() {
		return [ 'theme-specific-category' ];
	}

	protected function _register_controls() {

		$this->start_controls_section(
			'content_section',
			[
				'label' => __( 'Content', 'plugin-name' ),
				'tab' => \Elementor\Controls_Manager::TAB_CONTENT,
			]
		);

		$this->add_control(
			'title',
			[
				'label' => __( 'Block Title', 'plugin-name' ),
				'type' => \Elementor\Controls_Manager::TEXT,
				'input_type' => 'text',
				'placeholder' => __( 'Testimonials', 'plugin-name' ),
				'default' => 'Testimonials',
			]
		);
		$this->add_control(
			'testimonial_style',
			[
				'label' => __( 'Testimonial Style', 'plugin-domain' ),
				'type' => \Elementor\Controls_Manager::SELECT,
				'default' => 'style1',
				'options' => [
					'style1'  => __( 'Style1 | Home', 'plugin-domain' ),
					/*'style2' => __( 'Style2 | Innerpage', 'plugin-domain' ),*/
					'none' => __( 'None', 'plugin-domain' ),
				],
			]
		);		
		

		$this->end_controls_section();

	}

	protected function render() {

		$settings = $this->get_settings_for_display();
		//$settings['testimonial_style']
		$style='';
		$posts_per_page='10';
		if($settings['testimonial_style']=='style1') {
			$posts_per_page='4';
		}
		//_wp_page_template
		$args = array(
			'post_type' => array('page'),
			'posts_per_page' => -1,
			'order' => 'DESC',
			'meta_key' => '_wp_page_template',
			'meta_value' => 'page_books.php',
			/*'posts_per_page' => $posts_per_page,*/
		);		
		$testimlist = new WP_Query( $args );
		//var_dump($testimlist->found_posts);
		if ( $testimlist->have_posts() ) {
			if($settings['testimonial_style']=='style1') {
				$all_book_review='';
				while ( $testimlist->have_posts() ) {
					$testimlist->the_post();
				//$gvs_location=get_post_meta(get_the_ID(),'gvs_location',true);
				$input=get_post_custom(get_the_ID());
				if(!empty($input['bs_reviews'][0])) :
					$bs_reviews=unserialize($input['bs_reviews'][0]);
					if(count($bs_reviews)>=1) :
						foreach($bs_reviews as $bs_review):
							$all_book_review.='
							<div class="swiper-slide">
								<div class="testimonial-content-blk text-center">
									<div class="testimonial-content">
										<p>'.wp_trim_words($bs_review['description'],18,'...').'</p>
									</div>
									<div class="testimonial-title">
										<h4>'.$bs_review['title'].'</h4>
										<p>'.$bs_review['location'].'</p>
									</div>
								</div>
							</div>
							';
						endforeach;
					endif;
				endif;
				//echo $gvs_email;
				}
				
			echo '
			<div class="row">
				<div class="col-12 col-lg-8 offset-lg-2">
					<div class="testimonial-blk">
						<div class="testimonial-slider swiper-container">
							<div class="swiper-wrapper">
							'.$all_book_review.'
							</div>
							<div class="swiper-button-next1"></div>
							<div class="swiper-button-prev1"></div>
						</div>
					</div>
				</div>
			</div>			
			';
			
			
			}

			if($settings['testimonial_style']=='style2') {
				echo '
					<div class="container"><div class="row"><div class="col-12">
					<div class="swiper-container about-testimonial-slider">
						<div class="swiper-wrapper align-content-stretch">
				';
				while ( $testimlist->have_posts() ) {
					$testimlist->the_post();
					$gvs_email=get_post_meta(get_the_ID(),'gvs_email',true);
					$gvs_location=get_post_meta(get_the_ID(),'gvs_location',true);
					$gvs_review_for=get_post_meta(get_the_ID(),'gvs_review_for',true);
					$bs_rating=(int)get_post_meta(get_the_ID(),'rating',true);
					//the_post_thumbnail('medium',array('class'=>'m-auto img-fluid'));
						echo '
							<div class="swiper-slide">
								<div class="testimonial-list">
									<div class="testimonial-img">
										'.get_the_post_thumbnail(get_the_ID(),'thumbnail', array('class'=>'img-fluid rounded-circle')).'
									</div>
									<div class="testimonial-text">
										<p>'. ((!empty($gvs_review_for)) ? ($gvs_review_for) : 'GVS' ).' - '.wp_trim_words( get_the_content(), 16, '...' ).'</p>
									</div>
									<div class="testimonial-author">
										<h3 class="testi-user">- '.get_the_title().'</h3>
										<ul class="list-inline client-rating">
											'.(($bs_rating) ? str_repeat('<li class="list-inline-item"><i class="fas fa-star"></i></li>',$bs_rating) : '' ).'
										</ul>										
										<span>'.((!empty($gvs_location)) ? ('<p>'.$gvs_location.'</p>') : '').'</span>
									</div>
								</div>
							</div>

						';
				}
				echo '
						</div>
						<div class="swiper-pagination"></div>
						<div class="swiper-button-next"></div>
						<div class="swiper-button-prev"></div>
					</div>
					</div></div></div>					
				';
			}

			
		} else {
			echo 'nothing found';
		}
		wp_reset_postdata();

	}

}