Current File : /home/kelaby89/teamhachem.com/wp-content/plugins/lt-ext/shortcodes/services/view.php |
<?php if ( ! defined( 'ABSPATH' ) ) die( 'Forbidden' );
/**
* Services Shortcode
*/
$args = get_query_var('like_sc_services');
$class = '';
if ( !empty($args['class']) ) $class .= ' '. esc_attr($args['class']);
if ( !empty($args['id']) ) $id = ' id="'. esc_attr($args['id']). '"'; else $id = '';
$class .= ' layout-'.$args['layout'].' ltx-style-'.$args['style'];
$query_args = array(
'post_type' => 'services',
'post_status' => 'publish',
'posts_per_page' => (int)($args['limit']),
);
if ( !empty($args['ids']) ) $query_args['post__in'] = explode(',', esc_attr($args['ids']));
else
if ( !empty($args['cat']) ) {
$query_args['tax_query'] = array(
array(
'taxonomy' => 'services-category',
'field' => 'if',
'terms' => array(esc_attr($args['cat'])),
)
);
}
$query = new WP_Query( $query_args );
if ( $query->have_posts() ) {
echo '<div class="services-sc '.esc_attr($class).' row">';
$x = $iteration = 0;
while ( $query->have_posts() ):
$query->the_post();
$header = fw_get_db_post_option(get_The_ID(), 'header');
$cut = fw_get_db_post_option(get_The_ID(), 'cut');
$link = fw_get_db_post_option(get_The_ID(), 'link');
$icon = fw_get_db_post_option(get_The_ID(), 'icon');
$price = fw_get_db_post_option(get_The_ID(), 'price');
if ( !empty( $header) ) {
$header = str_replace(array('{{', '}}'), array('<span>', '</span>'), $header);
}
else {
$header = get_the_title();
}
if ( empty($link) ) {
$link = get_the_permalink();
}
$header = fw_get_db_post_option(get_The_ID(), 'header');
if ( !empty( $header) ) {
$header = str_replace(array('{{', '}}'), array('<span>', '</span>'), $header);
}
else {
$header = get_the_title();
}
if ( $args['layout'] == 'photos' ) {
$iteration++;
$x++;
if ( $iteration > 4) $iteration = 1;
$odd1 = $odd2 = '';
if ( $iteration > 2) {
$odd1 = ' col-lg-push-6 ltx-img-right ';
$odd2 = ' col-lg-pull-6 ';
}
else {
$odd1 = ' col-lg-push-0 ';
$odd2 = ' col-lg-pull-0 ';
}
if ( $x % 2 == 0 ) {
$odd1 .= ' col-md-push-6 ';
$odd2 .= ' col-md-pull-6 ';
}
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<div class="row">
<a data-mh="ltx-services" href="<?php echo esc_url( $link ); ?>" class="photo col-lg-6 col-ms-12 <?php echo esc_attr($odd1); ?>" style="background-image: url('<?php echo wp_get_attachment_image_url( get_post_thumbnail_id( get_The_ID()) , 'full') ?>')">
<?php
echo wp_get_attachment_image( get_post_thumbnail_id( get_The_ID()) , 'artkombat-service-full')
?>
</a>
<div data-mh="ltx-services" class="col-lg-6 col-ms-12 <?php echo esc_attr($odd2); ?>">
<div class="description">
<a href="<?php echo esc_url( $link ); ?>" class="heading header-underline header-underline-left">
<h4 class="header">
<?php echo wp_kses_post($header); ?>
</h4>
</a>
<?php
if (!empty($cut)) {
echo '<p>'.wp_kses_post( $cut ).'</p>';
}
if ( !empty($price) ) {
$price = str_replace(array('{{', '}}'), array('<span>', '</span>'), $price);
echo '<div class="price">'.wp_kses_post( $price ).'</div>';
}
?>
<a href="<?php echo esc_url( $link ); ?>" class="btn ">
<?php echo esc_html__( $args['more_text'] ); ?>
</a>
<?php
if ( !empty($args['image']) ) {
echo '<span class="watermark">'.wp_get_attachment_image( $args['image'] , 'full' ).'</span>';
}
?>
</div>
</div>
</div>
</article>
<?php
}
if ( $args['layout'] == 'list' ) {
?>
<article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
<?php
echo wp_get_attachment_image( $icon['attachment_id'] , 'artkombat-service-full')
?>
<a href="<?php echo esc_url( $link ); ?>" class="header">
<h5 class="header">
<?php echo wp_kses_post($header); ?>
</h5>
</a>
<?php
if (!empty($cut)) {
echo '<p>'.wp_kses_post( $cut ).'</p>';
}
?>
<a href="<?php echo esc_url( $link ); ?>" class="more">
<?php echo esc_html__( $args['more_text'] ); ?>
</a>
</article>
<?php
}
if ( $args['layout'] == 'classes' ) {
?>
<div class="col-lg-6">
<article data-mh="ltx-services-classes" id="post-<?php the_ID(); ?>" <?php post_class(); ?> style="background-image: url('<?php echo wp_get_attachment_image_url( get_post_thumbnail_id( get_The_ID()) , 'full') ?>')">
<?php
//echo wp_get_attachment_image( get_post_thumbnail_id( get_The_ID()) , 'artkombat-service-full')
?>
<a href="<?php echo esc_url( $link ); ?>" class="header">
<h4 class="header">
<?php echo wp_kses_post($header); ?>
</h4>
</a>
<?php
if (!empty($cut)) {
echo '<p>'.wp_kses_post( $cut ).'</p>';
}
?>
<a href="<?php echo esc_url( $link ); ?>" class="btn btn-main">
<?php echo esc_html__( $args['more_text'] ); ?>
</a>
<div class="mask"></div>
</article>
</div>
<?php
}
endwhile;
wp_reset_postdata();
echo '</div>';
}