Skip to content

Instantly share code, notes, and snippets.

@kloon
Created October 25, 2012 11:18
Show Gist options
  • Save kloon/3952058 to your computer and use it in GitHub Desktop.
Save kloon/3952058 to your computer and use it in GitHub Desktop.
WooCommerce Product Count Shortcode
function product_count_shortcode( ) {
$count_posts = wp_count_posts( 'product' );
return $count_posts->publish;
}
add_shortcode( 'product_count', 'product_count_shortcode' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment