Do you want to count the post specific to the WPML language?
If you are using WPML and you want to count current language posts, you can use the following code :
$args = array(
'post_type' => product',
'suppress_filters' => false,
"post_status" => 'publish'
);
$query = new WP_Query( $args );
$totalProducts = $query->found_posts;
Don’t Forget to add ‘suppress_filters’ => false parameter in your query.
If you want to display total posts count, irrespective of the languages; then use ‘suppress_filters’ =>true parameter in your query.
$args = array(
'post_type' => 'product',
'suppress_filters' => true,
"post_status" => 'publish'
);
$query = new WP_Query( $args );
$totalProducts = $query->found_posts;
Views: 211