File: /home/zwafgyp/dodolodge-net/wp-content/themes/hotel-wp/inc/widgets/posts/tpl/default.php
<?php
/**
* Template for displaying default element.
*
*
* @author ThimPress
* @package Thim_Builder/Templates
* @version 1.0.0
* @author Thimpress, tuanta
*/
$button = $html = '';
$post_column = isset( $instance['post_column'] ) ? $instance['post_column'] : '4';
$css_animation = thim_getCSSAnimation( $instance['css_animation'] );
$class = 'col-sm-6 col-md-' . ( 12 / $post_column );
// Heading primary inline style
$readmore_text = '';
if ( $instance['readmore_text'] != '' ) {
$readmore_text = $instance['readmore_text'];
} else {
$readmore_text = esc_html__( 'Read More', 'hotel-wp' );
}
$readmore_css = '';
if ( $instance['readmore_color'] ) {
$readmore_css .= 'color: ' . $instance['readmore_color'] . ';';
}
if ( $readmore_css ) {
$readmore_css = 'style="' . $readmore_css . '"';
}
// Backgroudn Color
$category_css = '';
if ( $instance['bg_category'] ) {
$category_css .= 'background-color: ' . $instance['bg_category'] . ';';
}
if ( $category_css ) {
$category_css = 'style="' . $category_css . '"';
}
$posts_args = array(
'posts_per_page' => $instance['post_limit'],
'ignore_sticky_posts' => 1,
'cat' => $instance['cat_id']
);
$posts = new WP_Query( $posts_args );
$i = 0;
$html .= '<div class="thim-sc-posts site-content ' . $css_animation . ' ">';
$html .= '<div class="blog-content row">';
if ( $instance['style'] == 'style-3' ) {
if ( $i == 0 ) {
$html .= '<div class="item-first col-sm-12 col-md-6">';
}
}
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) :
$posts->the_post();
global $post;
$thim_info = get_post_meta( $post->ID, 'thim_info', true );
//Set Class Style 3
$i ++;
if ( $instance['style'] == 'style-3' ) {
if ( $i == 1 ) {
$class = 'col-sm-12 col-md-12 post-item-first';
} else {
$class = 'col-sm-6 col-md-6 post-item';
}
}
$html .= '<article id="post-' . get_the_ID() . '" class="' . $class . ' ' . $instance['style'] . '">';
$html .= '<div class="content-inner">';
$html .= '<div class="entry-top">';
$img_src = wp_get_attachment_image_url( get_post_thumbnail_id( get_the_ID() ), [ 370, 300 ] );
if ( $instance['style'] == 'style-3' ) {
if ( $i == 1 ) {
$img_src = wp_get_attachment_image_url( get_post_thumbnail_id( get_the_ID() ), [ 570, 462 ] );
}
}
if ( $img_src ) {
$html .= '<div class="thumbnail"><a href="' . esc_url( get_permalink( get_the_ID() ) ) . '">';
$html .= '<img src="' . esc_attr( $img_src ) . '" alt="' . get_the_title() . '" title="' . get_the_title() . '"/>';
$html .= '</a></div>';
}
$html .= ' </div> ';
$html .= '<div class="entry-content"> ';
if ( $instance['style'] == 'style-3' ) {
if ( $instance['category_button'] == true ) {
$categories_list = get_the_category_list( ' - ' );
$html .= '<div class="entry-category" ' . $category_css . '>';
$html .= $categories_list;
$html .= '</div>';
}
}
if ( $instance['style'] == 'style-1' ) {
$html .= '<div class="entry-meta">';
$html .= thim_get_entry_meta_date();
$html .= '</div>';
}
$html .= '<header class="entry-header"> ';
$html .= '<h3 class="entry-title"><a href="' . esc_url( get_permalink() ) . '" rel="bookmark"> ' . get_the_title() . '</a></h3>';
$html .= '</header>';
if ( $instance['style'] == 'style-3' ) {
$html .= '<div class="entry-meta">';
$html .= '<span class="entry-date">' . get_the_date( 'j M, Y' ) . '</span>';
$html .= '</div>';
}
if ( $instance['style'] == 'style-2' ) {
if ( $instance['info_button'] == true ) {
if ( $thim_info ) {
$html .= '<div class="entry-info" > ';
$html .= $thim_info;
$html .= '</div>';
}
}
}
if ( $instance['style'] == 'style-2' || $instance['style'] == 'style-3' ) {
if ( $instance['excerpt_button'] == true ) {
$html .= '<div class="entry-summary" > ';
$html .= esc_attr( get_the_excerpt() );
$html .= '</div>';
}
}
if ( $instance['post_button'] == false ) {
$html .= '<div class="readmore' . esc_attr( $button ) . '" > ';
$html .= '<a href = "' . esc_url( get_permalink() ) . '" ' . $readmore_css . ' ><i class="icomoon icon-up"></i> ' . $readmore_text . ' </a> ';
$html .= '</div>';
}
$html .= '</div> ';
$html .= '</div> ';
$html .= '</article> ';
if ( $instance['style'] == 'style-3' ) {
if ( $i == 1 ) {
$html .= '</div>';
$html .= '<div class="item col-sm-12 col-md-6">';
}
}
endwhile;
}
if ( $instance['style'] == 'style-3' ) {
$html .= '</div>';
}
$html .= '</div>';
$html .= '</div>';
wp_reset_postdata();
echo ent2ncr( $html );