';
if (boal_is_featured()) {
echo '
';
} else {
echo '
';
}
echo '';
}
}
if ( function_exists( 'add_theme_support' ) ) {
add_filter( 'manage_posts_columns' , 'boal_add_thumbnail_columns' );
add_action( 'manage_posts_custom_column' , 'boal_add_thumbnail_columns_data', 10, 2 );
}
/* PostViews =========================================================================================================*/
function boal_post_views($post_ID)
{
$count_key = 'post_views_count';
$count = get_post_meta($post_ID, $count_key, true);
if ($count == '') {
delete_post_meta($post_ID, $count_key);
add_post_meta($post_ID, $count_key, '0');
} else {
$count++;
update_post_meta($post_ID, $count_key, $count);
}
}
function boal_track_post_views($post_id)
{
if (!is_single()) return;
if (empty ($post_id)) {
global $post;
$post_id = $post->ID;
}
boal_post_views($post_id);
}
add_action('wp_head', 'boal_track_post_views');
function boal_get_PostViews($post_ID)
{
$count_key = 'post_views_count';
$count = get_post_meta($post_ID, $count_key, true);
return $count;
}
function boal_post_column_views($newcolumn)
{
$newcolumn['post_views'] = esc_html__('Views', 'boal');
return $newcolumn;
}
function boal_post_custom_column_views($column_name, $id)
{
if ($column_name === 'post_views') {
echo esc_attr(boal_get_PostViews(get_the_ID()));
}
}
add_filter('manage_posts_columns', 'boal_post_column_views');
add_action('manage_posts_custom_column', 'boal_post_custom_column_views', 10, 2);
/* Move comment field to bottom ======================================================================================*/
function boal_move_comment_field_to_bottom( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'boal_move_comment_field_to_bottom' );
?>