Added function to functions.php, called function in snippet, not working
-
Hi,
I added this code to my functions.php:
function show_dimensions() { global $product; $dimensions = $product->get_dimensions(); if ( ! empty( $dimensions ) ) { echo '<div class="dimensions"><b>Height:</b> ' . $product->get_height() . get_option( 'woocommerce_dimension_unit' ); echo '<br><b>Width:</b> ' . $product->get_width() . get_option( 'woocommerce_dimension_unit' ); echo '<br><b>Length:</b> ' . $product->get_length() . get_option( 'woocommerce_dimension_unit' ); echo '</div>'; } }
Then I added this snippet to the editor of the plugin:
show_dimensions(); ?>
And nothing is displaying in the front-end where I’m using the shortcode.
I tried this with other plugins and they worked on front-end, but gave me a 500 error in the WP editor. Now I can’t even get to the 500 error ??
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Added function to functions.php, called function in snippet, not working’ is closed to new replies.