Created
May 4, 2012 14:02
-
-
Save coenjacobs/2594971 to your computer and use it in GitHub Desktop.
Display WooCommerce product dimensions on archive pages, right below the title of the product
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
<?php | |
/* | |
Plugin Name: WooCommerce Show Dimensions On Archive | |
Description: Display product dimensions on archive pages, right below the title of the product. | |
Version: 1.0 | |
Author: Coen Jacobs | |
Author URI: http://coenjacobs.me | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item_title', 'cj_show_dimensions', 9 ); | |
function cj_show_dimensions() { | |
global $product; | |
$dimensions = $product->get_dimensions(); | |
if ( ! empty( $dimensions ) ) { | |
echo '<span class="dimensions">' . $dimensions . '</span>'; | |
} | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
hi Great Stuff!!! Instead of displaying just the dimensions i need to display in the format of https://jsfiddle.net/kaviarasukr/z8byafmq/ any ideas of how to do it.