File: /home/dermova/public_html/india/wp-content/plugins/rit-core/inc/shortcode/rit_testimonial.php
<?php
function rit_shortcode_testimonial($atts)
{
global $post;
$atts = shortcode_atts(
array(
'title' =>'',
'posts_per_page' => '',
'number' => 1,
'target' => '_blank',
'auto' => 'true',
'el_class' => '',
), $atts);
$args = array(
'posts_per_page' => $atts['posts_per_page'],
'post_type' => 'testimonial'
);
$the_query = new WP_Query($args);
ob_start(); ?>
<div class="widget widget-testimonial">
<?php if ( $atts['title'] ) {?>
<h3 class="widget-title">
<span><?php echo htmlspecialchars_decode( $atts['title'] ); ?></span>
</h3>
<?php }?>
<div class="widget-content rit-testimonial <?php echo $atts['el_class'];?>" data-number="<?php echo $atts['number'];?>" data-auto="<?php echo $atts['auto'];?>">
<?php
if ($the_query->have_posts()) :
while ($the_query->have_posts()) : $the_query->the_post();
$poster_image = get_post_meta($post->ID, 'rit_testimonial_image', true);
$testimonial_position = get_post_meta($post->ID, 'rit_testimonial_position', true);
?>
<div class="testimonial_item">
<div class="des-testimonial"><?php the_content();?></div>
<div class="img-author">
<?php
if(isset($poster_image) && !empty($poster_image)){
echo '<img class="img-circle" src="'. wp_get_attachment_url($poster_image) .'" alt="image author" />';
}
?>
</div>
<div class="author"><?php the_title();?></div>
<div class="testimonial_position">
<p><?php echo $testimonial_position ;?></p>
</div>
</div>
<?php
endwhile;
endif;
wp_reset_postdata();
?>
</div>
</div>
<!-- /.services -->
<?php
$output = ob_get_contents();
ob_end_clean();
return $output;
}
add_shortcode('rit_testimonial', 'rit_shortcode_testimonial');
add_action('vc_before_init', 'rit_testimonial_integrate_vc');
if (!function_exists('rit_testimonial_integrate_vc')) {
function rit_testimonial_integrate_vc()
{
vc_map(
array(
'name' => __('RIT Testimonial', RIT_TEXT_DOMAIN),
'base' => 'rit_testimonial',
'icon' => 'icon-rit',
'category' => __('RIT', RIT_TEXT_DOMAIN),
'description' => __('Show testimonial carousel', RIT_TEXT_DOMAIN),
'params' => array(
array(
'type' => 'textfield',
'heading' => __('Title Widget', RIT_TEXT_DOMAIN),
'value' => '',
'param_name' => 'title',
),
array(
'type' => 'textfield',
'heading' => __('Number item show', RIT_TEXT_DOMAIN),
'value' => '',
'param_name' => 'number',
),
array(
'type' => 'textfield',
'heading' => __('Number of testimonial', RIT_TEXT_DOMAIN),
'value' => '',
'param_name' => 'posts_per_page',
),
array(
'type' => 'dropdown',
'heading' => __( 'Link Target', RIT_TEXT_DOMAIN ),
'param_name' => 'target',
'value' => array(
__( 'Same window', RIT_TEXT_DOMAIN ) => '_self',
__( 'New window', RIT_TEXT_DOMAIN ) => "_blank"
),
'dependency' => array(
'element' => 'img_link',
'not_empty' => true
)
),
array(
'type' => 'checkbox',
'heading' => __( 'Auto slide', RIT_TEXT_DOMAIN ),
'param_name' => 'auto',
'description' => __( 'If checked, image will auto run carousel.', RIT_TEXT_DOMAIN ),
'value' => array( __( 'Yes', RIT_TEXT_DOMAIN ) => 'true' )
),
array(
'type' => 'textfield',
'heading' => __( 'Extra class name', RIT_TEXT_DOMAIN ),
'param_name' => 'el_class',
'description' => __( 'Style particular content element differently - add a class name and refer to it in custom CSS.', RIT_TEXT_DOMAIN )
)
)
)
);
}
}