I have created a custom post type and attached it to a Custom Taxonomy. I used Advanced Custom Fields to add an image upload option to taxonomy.
But I can't retrieve image in Front End. I used below code to get the image URL. But it is not working.
<img src="<?php bloginfo('url'); ?>/wp-content/uploads/<?php echo get_post_meta(get_ani_taxonomy_fields($ani->term_id, 'acf_image_field_name'), '_wp_attached_file', true); ?>" />
How can I get this to work?
Thanks in advance
I have created a custom post type and attached it to a Custom Taxonomy. I used Advanced Custom Fields to add an image upload option to taxonomy.
But I can't retrieve image in Front End. I used below code to get the image URL. But it is not working.
<img src="<?php bloginfo('url'); ?>/wp-content/uploads/<?php echo get_post_meta(get_ani_taxonomy_fields($ani->term_id, 'acf_image_field_name'), '_wp_attached_file', true); ?>" />
How can I get this to work?
Thanks in advance
Share Improve this question asked Aug 2, 2019 at 8:21 xy_proxy_pro 1 1- Can you please let me know name of"custom post type", "taxonomy" and "acf image field" so I can help you. – Tanmay Patel Commented Aug 2, 2019 at 16:53
1 Answer
Reset to default 0use this snippet here i get image which have post id 5
<img src='<?php echo site_url(); ?>/wp-content/uploads/<?php echo get_post_meta(5,'_wp_attached_file',true); ?>' height="100" width="100">
check get_ani_taxonomy_fields($ani->term_id, 'acf_image_field_name') this function return post id
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745275702a4620026.html
评论列表(0条)