Created
December 5, 2012 19:13
-
-
Save kloon/4218605 to your computer and use it in GitHub Desktop.
WooCommerce Product Count Shortcode
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// [product_count] shortcode | |
function product_count_shortcode( ) { | |
$count_posts = wp_count_posts( 'product' ); | |
return $count_posts->publish; | |
} | |
add_shortcode( 'product_count', 'product_count_shortcode' ); |
@pipolocosisi you can check it here : https://gist.github.com/LetsCommit/c821b96845998375769dcabfcc9c8ff5
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'd like to use this to bypass the woocommerce product counter (which is not displayed for obscure reasons)
How can I add static text in the result to be displayed like "There are X product(s)"?