Skip to content

Instantly share code, notes, and snippets.

@jamesckemp
Last active November 29, 2017 01:28
Show Gist options
  • Save jamesckemp/8481c421fcda19d24e5859f2a7b592de to your computer and use it in GitHub Desktop.
Save jamesckemp/8481c421fcda19d24e5859f2a7b592de to your computer and use it in GitHub Desktop.
Add some custom text (from an ACF field) to the product loop
<?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