تعداد محصولات :
$sevenhost_total_product = wp_count_posts( 'product' );
number_format_i18n( $sevenhost_total_product->publish );
تعداد نوشته ها :
$sevenhost_total_post = wp_count_posts( 'post' );
number_format_i18n( $sevenhost_total_post->publish );
تعداد دیدگاه :
$sevenhost_total_comments = wp_count_comments();
number_format_i18n( $sevenhost_total_comments->approved );
تعداد کاربران :
$sevenhost_total_users = count_users();
number_format_i18n( $sevenhost_total_users['total_users'] );
تعداد فروش کل فروشگاه :
function sevenhost_total_sales() {
$total = 0;
$args = array(
'post_type' => 'product',
'posts_per_page' => - 1,
);
$posts = new WP_Query( $args );
if ( $posts->have_posts() ) {
while ( $posts->have_posts() ) {
$posts->the_post();
$count = get_post_meta( $posts->post->ID, 'total_sales', true );
$total += intval( $count );
}
wp_reset_postdata();
}
return $total;
}
number_format_i18n( sevenhost_total_sales() );