-
-
Save hirejordansmith/314a79818a4e89ea88497cf17d57e2f6 to your computer and use it in GitHub Desktop.
How to add additional content below the Single Product Short Description in Woocommerce
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 | |
/** | |
* How to add text or other content below the Single Product Short Description in Woocommerce | |
* | |
* @author Jordan Smith <jordan@hirejordansmith.com> | |
* @link https://hirejordansmith.com | |
*/ | |
// Basic Use Case | |
add_action( 'woocommerce_single_product_summary', 'hjs_below_single_product_summary', 20 ); | |
function hjs_below_single_product_summary() { | |
// Add Your Additional Content Here | |
} | |
// Real World Example using ACF to integrate a dynamic YouTube video id via custom field | |
add_action( 'woocommerce_single_product_summary', 'hjs_video_below_single_product_summary', 20 ); | |
function hjs_video_below_single_product_summary() { | |
$video_id = get_field('product_video_id'); ?> | |
<div class="product-video"> | |
<a class="popup-youtube button" href="http://www.youtube.com/watch?v=<?php echo $video_id; ?>&rel=0&controls=0&showinfo=0">Watch Video</a> | |
</div> | |
<?php } | |
// Real World Example adding a shortcode below the Single Product Short Description | |
add_action( 'woocommerce_single_product_summary', 'hjs_shortcode_below_single_product_summary', 20 ); | |
function hjs_shortcode_below_single_product_summary() { | |
echo do_shortcode('[your_shortcode]'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment