';
$count = 4;
$slidecat = get_theme_mod( 'avrilly_slider_cat' );
$slidecat = isset($slidecat) ? $slidecat : '';
$active_slide = "active";
$query = new WP_Query( array( 'cat' => $slidecat,'posts_per_page' => $count ) );
if ($query->have_posts()) :
while ($query->have_posts()) : $query->the_post();
$num_comments = get_comments_number(); // get_comments_number returns only a numeric value
if ( comments_open() ) {
if ( $num_comments == 0 ) {
$comments = __('No Comments','avrilly');
} elseif ( $num_comments > 1 ) {
$comments = $num_comments . __(' Comments','avrilly');
} else {
$comments = __('1 Comment','avrilly');
}
$write_comments = $comments;
} else {
$write_comments = __('Comments are off for this post.','avrilly');
}
echo '
'; // .mz-slider-item
echo '
';
$active_slide = "";
endwhile; wp_reset_postdata();
endif;
echo '
';
}
}
endif;
/**
* Returns just the URL of an image attachment.
*
* @param int $image_id The Attachment ID of the desired image.
* @param string $size The size of the image to return.
* @return bool|string False on failure, image URL on success.
*/
function avrilly_get_image_src( $image_id, $size = 'full' ) {
$img_attr = wp_get_attachment_image_src( intval( $image_id ), $size );
if ( ! empty( $img_attr[0] ) ) {
return $img_attr[0];
}
}
/*
* Add boostrap classes fot tables
*/
add_filter( 'the_content', 'avrilly_add_custom_table_class' );
function avrilly_add_custom_table_class( $content ) {
return str_replace( '