Last active
November 29, 2017 01:28
-
-
Save jamesckemp/8481c421fcda19d24e5859f2a7b592de to your computer and use it in GitHub Desktop.
Add some custom text (from an ACF field) to the product loop
This file contains hidden or 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 | |
/* | |
* Add this code to your functions.php file | |
*/ | |
add_action( 'woocommerce_after_shop_loop_item_title', 'jck_custom_text', 15 ); | |
function jck_custom_text() { | |
the_field('your_field_key'); | |
} | |
/* -- OR -- */ | |
function jck_custom_text() { | |
echo "You can echo any text here"; | |
} | |
/* -- OR -- */ | |
function jck_custom_text() { | |
global $product; | |
// access the product object | |
echo $product->id; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment