ID;
}
$vmagazine_related_posts_type = get_theme_mod( 'vmagazine_related_post_type', 'related_cat' );
$vmagazine_related_post_count = get_theme_mod('vmagazine_related_post_count',3);
$vmagazine_related_post_excerpt = get_theme_mod('vmagazine_related_post_excerpt',200);
// Define related post arguments
$related_args = array(
'no_found_rows' => true,
'update_post_meta_cache' => false,
'update_post_term_cache' => false,
'ignore_sticky_posts' => 1,
'orderby' => 'rand',
'post__not_in' => array( $post_id ),
'posts_per_page' => absint($vmagazine_related_post_count)
);
if ( $vmagazine_related_posts_type == 'related_tag' ) {
$tags = wp_get_post_tags( $post_id );
if ( $tags ) {
$tag_ids = array();
foreach( $tags as $individual_tag ) $tag_ids[] = $individual_tag->term_id;
$related_args['tag__in'] = $tag_ids;
}
} else {
$categories = get_the_category( $post_id );
if ( $categories ) {
$category_ids = array();
foreach( $categories as $individual_category ) {
$category_ids[] = $individual_category->term_id;
}
$related_args['category__in'] = $category_ids;
}
}
$related_query = new WP_Query( $related_args );
if( $related_query->have_posts() ) {
?>
1,
'post_type' => 'post',
'ignore_sticky_posts' => true,
'orderby' => 'rand'
);
$vmagazine_random_post_query = new WP_Query( $vmagazine_random_post_args );
while( $vmagazine_random_post_query->have_posts() ) {
$vmagazine_random_post_query->the_post();
?>
';
foreach( $categories as $category ) {
$output .= ''.$category->cat_name.'';
}
$output .='';
echo wp_kses_post(trim( $output, $separator ));
}
}
}
endif;
/*===========================================================================================================*/
/**
* Display single category name only
*
*/
add_action('vmagazine_lite_single_cat','vmagazine_lite_single_cat');
if( ! function_exists('vmagazine_lite_single_cat') ){
function vmagazine_lite_single_cat(){
$categories = get_the_category();
$cat_link = get_category_link( $categories[0]->term_id );
if ( ! empty( $categories ) ) {
echo '';
echo ''.esc_html($categories[0]->name).'';
echo '';
}
}
}
/*===========================================================================================================*/
/**
* Post format icon for homepage widget
*
* @since 1.0.0
*/
add_action( 'vmagazine_lite_post_format_icon', 'vmagazine_lite_post_format_icon_cb' );
if( ! function_exists( 'vmagazine_lite_post_format_icon_cb' ) ) {
function vmagazine_lite_post_format_icon_cb() {
global $post;
$post_id = $post->ID;
$post_format = get_post_format( $post_id );
if( $post_format == 'video' ) {
echo '';
} elseif( $post_format == 'audio' ) {
echo '';
} elseif( $post_format == 'gallery' ) {
echo '';
} else { }
}
}
/*===========================================================================================================*/
/**
* Mobile Navigation
*
*/
if( ! function_exists('vmagazine_lite_mob_nav_logo') ){
function vmagazine_lite_mob_nav_logo(){
$vmagazine_mobile_header_logo = get_theme_mod('vmagazine_mobile_header_logo');
$image_id = get_post_thumbnail_id();
$image_alt = get_post_meta( $image_id, '_wp_attachment_image_alt', true );
if( $vmagazine_mobile_header_logo ){ ?>