';
$additional_html = $additional_html . $translator_view . '';
}
print_item_header( find_xml_value($item_xml, 'header'), $additional, $additional_html );
global $paged, $sidebar_type, $blog_div_size_num_class;
if(empty($paged)){ $paged = (get_query_var('page')) ? get_query_var('page') : 1; }
if($pagination == "No"){ $paged = 1; }
if($paged != '1'){ $offset = 0; }
// get the item class and size from array
$item_type = find_xml_value($item_xml, 'item-size');
$item_class = $blog_div_size_num_class[$item_type]['class'];
$item_size = $blog_div_size_num_class[$item_type][$sidebar_type];
// get the blog meta value
$num_fetch = find_xml_value($item_xml, 'num-fetch');
$num_excerpt = find_xml_value($item_xml, 'num-excerpt');
$full_content = find_xml_value($item_xml, 'show-full-blog-post');
$category = find_xml_value($item_xml, 'category', false);
$category = ( $category == 'All' )? '': $category;
$order = find_xml_value($item_xml, 'order');
$orderby = find_xml_value($item_xml, 'orderby');
// start fetching database
query_posts(array('post_type'=>'post', 'paged'=>$paged, 'order'=>$order, 'orderby'=>$orderby,
'category_name'=>$category, 'posts_per_page'=>$num_fetch, 'offset'=>$offset ));
// printing each blog function
echo '
';
if( $item_type == '1/4 Blog Grid' || $item_type == '1/3 Blog Grid' ||
$item_type == '1/2 Blog Grid' || $item_type == '1/1 Blog Grid'){
print_blog_grid($item_class, $item_size, $num_excerpt, $full_content, $item_type);
}else if( $item_type == '1/1 Blog List' ){
print_blog_list($item_class, $item_size);
}else if( $item_type == '1/4 Blog Grid List' || $item_type == '1/3 Blog Grid List' ||
$item_type == '1/2 Blog Grid List' || $item_type == '1/1 Blog Grid List'){
$list_size = $blog_div_size_num_class['1/1 Blog List'][$sidebar_type];
print_blog_grid_list($item_class, $item_size, $list_size, $num_excerpt, $full_content, $item_type);
}else if( $item_type == '1/1 Medium Thumbnail' ){
print_blog_medium($item_class, $item_size, $num_excerpt, $full_content);
}
echo '
';
echo '';
if( $pagination == "Yes" ){
pagination();
}
wp_reset_query();
}
// print the blog thumbnail
function print_blog_thumbnail( $post_id, $item_size, $enable_comment = false ){
if( empty($item_size) ){ return ''; }
$thumbnail_types = get_post_meta( $post_id, 'post-option-thumbnail-types', true);
if( $thumbnail_types == "Image" || empty($thumbnail_types) ){
$thumbnail_id = get_post_thumbnail_id( $post_id );
$thumbnail = wp_get_attachment_image_src( $thumbnail_id , $item_size );
$alt_text = get_post_meta($thumbnail_id , '_wp_attachment_image_alt', true);
if( !empty($thumbnail) ){
echo '';
echo '
';
if( $enable_comment ){
echo '';
}
echo '
'; // blog-media-wrapper
}
}else if( $thumbnail_types == "Video" ){
$video_link = get_post_meta( $post_id, 'post-option-thumbnail-video', true);
echo '';
echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size));
echo '
'; // blog-media-wrapper
}else if ( $thumbnail_types == "Slider" ){
$slider_xml = get_post_meta( $post_id, 'post-option-thumbnail-xml', true);
$slider_xml_dom = new DOMDocument();
$slider_xml_dom->loadXML($slider_xml);
echo '';
echo print_flex_slider($slider_xml_dom->documentElement, $item_size);
echo '
'; // blog-media-wrapper
}else if ( $thumbnail_types == "HTML5 Video" ){
$video = get_post_meta( $post_id, 'post-option-thumbnail-html5-video', true);
echo '';
get_html5_video($video);
echo '
'; // blog-media-wrapper
}
}
// print the blog thumbnail
function print_single_blog_thumbnail( $post_id, $item_size ){
$thumbnail_types = get_post_meta( $post_id, 'post-option-inside-thumbnail-types', true);
if( $thumbnail_types == "Image" || empty($thumbnail_types) ){
$thumbnail_id = get_post_meta( $post_id, 'post-option-inside-thumbnial-image', true);
$thumbnail = wp_get_attachment_image_src( $thumbnail_id , $item_size );
$thumbnail_full = wp_get_attachment_image_src( $thumbnail_id , 'full' );
$alt_text = get_post_meta($thumbnail_id , '_wp_attachment_image_alt', true);
if( !empty($thumbnail) ){
echo ''; // blog-media-wrapper
}
}else if( $thumbnail_types == "Video" ){
$video_link = get_post_meta( $post_id, 'post-option-inside-thumbnail-video', true);
echo '';
echo get_video($video_link, gdl_get_width($item_size), gdl_get_height($item_size));
echo '
'; // blog-media-wrapper
}else if ( $thumbnail_types == "Slider" ){
$slider_xml = get_post_meta( $post_id, 'post-option-inside-thumbnail-xml', true);
$slider_xml_dom = new DOMDocument();
$slider_xml_dom->loadXML($slider_xml);
echo '';
echo print_flex_slider($slider_xml_dom->documentElement, $item_size);
echo '
'; // blog-media-wrapper
}else if ( $thumbnail_types == "HTML5 Video" ){
$video = get_post_meta( $post_id, 'post-option-inside-thumbnail-html5-video', true);
echo '';
get_html5_video($video);
echo '
'; // blog-media-wrapper
}
}
// print blog widget type
function print_blog_grid( $item_class, $item_size, $num_excerpt, $full_content, $blog_size ){
global $more, $gdl_date_format, $gdl_admin_translator;
if( $gdl_admin_translator == 'enable' ){
$translator_continue_reading = get_option(THEME_SHORT_NAME.'_translator_continue_reading', 'Continue Reading');
}else{
$translator_continue_reading = __('Continue Reading ','gdl_front_end');
}
if( $full_content == 'Yes' ){ $more = 0; }
$blog_row_size = 0;
$blog_size = str_replace(' Blog Grid', '', $blog_size);
while( have_posts() ){
the_post();
$blog_row_size = print_item_size($blog_size, $blog_row_size, $item_class . '');
// blog content
echo '';
// blog thumbnail
print_blog_thumbnail( get_the_ID(), $item_size, true );
echo '
';
echo '
';
if( $full_content == "No" ){
echo gdl_get_excerpt( $num_excerpt, '... ' );
}else{
the_content($translator_continue_reading);
}
// blog information
echo '
';
echo '
';
echo '
' . __('Posted On' , 'gdl_front_end') . ' ';
echo '
';
echo get_the_time($gdl_date_format);
echo '';
echo '
';
echo '
';
echo ', ';
echo '' . __('By' , 'gdl_front_end') . ' ';
echo the_author_posts_link();
echo '
';
echo '
';
echo '
'; // blog information
echo '
'; // blog content
echo '
'; // blog content wrapper
echo ''; // item_class
}
echo '';
echo ''; // close row
}
// print blog list
function print_blog_list( $item_class, $item_size ){
global $gdl_date_format, $gdl_admin_translator;
while( have_posts() ){
the_post();
// blog content
echo '';
// blog thumbnail
print_blog_thumbnail( get_the_ID(), $item_size );
echo '
';
echo '
';
// blog information
echo '
';
echo '
';
echo '
' . __('Posted On' , 'gdl_front_end') . ' ';
echo '
';
echo get_the_time($gdl_date_format);
echo '';
echo'
';
echo '
';
echo ', ';
echo '' . __('By' , 'gdl_front_end') . ' ';
echo the_author_posts_link();
echo '
';
echo '';
echo '
';
echo '
'; // blog info wrapper
echo '
'; // blog content wrapper
echo '
';
echo '
'; // item class
}
}
// print blog widget type
function print_blog_grid_list( $item_class, $item_size, $list_size, $num_excerpt, $full_content, $blog_size ){
global $more, $gdl_date_format, $gdl_admin_translator;
$gdl_num_post = 0;
if( $gdl_admin_translator == 'enable' ){
$translator_continue_reading = get_option(THEME_SHORT_NAME.'_translator_continue_reading', 'Continue Reading');
}else{
$translator_continue_reading = __('Continue Reading ','gdl_front_end');
}
if( $full_content == 'Yes' ){ $more = 0; }
$blog_row_size = 0;
$blog_size = str_replace(' Blog Grid List', '', $blog_size);
// $item_class
while( have_posts() ){
the_post(); $gdl_num_post++;
if( $gdl_num_post <= 1 ){
echo '';
// blog content
echo '
';
// blog thumbnail
print_blog_thumbnail( get_the_ID(), $item_size, true );
echo '
';
echo '
';
if( $full_content == "No" ){
echo gdl_get_excerpt( $num_excerpt, '... ' );
}else{
the_content($translator_continue_reading);
}
// blog information
echo '
';
echo '
';
echo '
' . __('Posted On' , 'gdl_front_end') . ' ';
echo '
';
echo get_the_time($gdl_date_format);
echo '';
echo '
';
echo '
';
echo ', ';
echo '' . __('By' , 'gdl_front_end') . ' ';
echo the_author_posts_link();
echo '
';
echo '
';
echo '
'; // blog information
echo '
'; // blog content
echo '
'; // blog content wrapper
echo '
'; // gdl blog grid
}else{
// blog content
echo '';
// blog thumbnail
print_blog_thumbnail( get_the_ID(), $list_size );
echo '
';
echo '
';
// blog information
echo '
';
echo '
';
echo '
' . __('Posted On' , 'gdl_front_end') . ' ';
echo '
';
echo get_the_time($gdl_date_format);
echo '';
echo'
';
echo '
';
echo ', ';
echo '' . __('By' , 'gdl_front_end') . ' ';
echo the_author_posts_link();
echo '
';
echo '
';
echo '
'; // blog info wrapper
echo '
'; // blog content wrapper
echo '
';
echo '
'; // item class
}
}
}
// print blog medium thumbnail type
function print_blog_medium( $item_class, $item_size, $num_excerpt, $full_content ){
global $gdl_admin_translator, $more, $gdl_date_format;
if( $full_content == 'Yes' ){ $more = 0; }
if( $gdl_admin_translator == 'enable' ){
$translator_continue_reading = get_option(THEME_SHORT_NAME.'_translator_continue_reading', 'Continue Reading');
}else{
$translator_continue_reading = __('Continue Reading ','gdl_front_end');
}
while( have_posts() ){
the_post();
echo '';
echo '
';
// blog thumbnail
echo '
';
print_blog_thumbnail( get_the_ID(), $item_size, true );
echo '
'; // blog-medium-media-wrapper
echo '
';
// blog title
echo '
';
// blog content
echo '
';
if( $full_content == "No" ){
echo gdl_get_excerpt( $num_excerpt, '... ' );
}else{
the_content($translator_continue_reading);
}
echo '
';
// blog information
echo '
';
echo '
';
echo '
' . __('Posted On' , 'gdl_front_end') . ' ';
echo '
';
echo get_the_time($gdl_date_format);
echo '';
echo '
';
echo '
';
echo ', ';
echo '' . __('By' , 'gdl_front_end') . ' ';
echo the_author_posts_link();
echo '
';
echo '
';
echo '
'; // blog information
echo '
'; // blog-context-wrapper
echo '
';
echo '
'; // blog-content-wrapper
echo '
'; // blog-item
}
}
?>