i am using advanced custom filed and i made custom author field (it could be Publisher Or Brand etc) now this author's name is not printing on product (Book) page . in custom field its for author's name slug is 'names'
add_action( 'woocommerce_after_single_product_summary', "ACF_product_content", 10 );
function ACF_product_content(){
echo '<h2> ACF Content </h2>';
if (function_exists('the_field')){
echo '<p>Woohoo, the_field function exists! </p>';
//the_field('authors');
echo '<pre>';
print_r(get_the_ID());
echo '</pre>';
echo '<pre>';
print_r(get_field('authors'));
echo '</pre>';
die;
}
}
for this i got the result Check this report screenshot . now problem is to show the Authors name which is ['post_title'] in this array. i tried so many solutions but not working its not showing the result. i used to show this result by this code
echo the_field('names');
'names' is the field name in 'Authors' custom field.
You may use one of the methods below . You have to strictly set $post otherwise
get_the_ID()
funtion returnfalse
.OR
try this code for ACF
fetch the post title
for display author name for below function