Skip to content

Instantly share code, notes, and snippets.

@woogist
Created June 4, 2015 13:47
Show Gist options
  • Save woogist/37ce42d965176c0e966a to your computer and use it in GitHub Desktop.
Save woogist/37ce42d965176c0e966a to your computer and use it in GitHub Desktop.
function wc_loop_stock_show( $atts, $content = null ) {
extract( shortcode_atts( array( 'product' => '' ) ), $atts );
echo '<p class="total-sales">Sold: ' . absint( get_post_meta( $product, 'total_sales', true ) ) . '</p>';
}
add_shortcode( 'sold', 'wc_loop_stock_show' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment