admin管理员组文章数量:1318032
I am trying to get the below action to display on an archive page on my site via Code Snippets:
add_action( 'woocommerce_after_shop_loop', 'test_text', 42);
function test_text() {
the_field('group_5f7ee777725c8', 42);
}
This is a hook for Advanced Custom Fields to display some basic text on an archive page (product_cat), ACF support say that this should work - but I cannot get it to display. ACF support have stressed that I need to look at how I am implementing this code, but I can see nothing wrong with implementing this how I am trying (Code Snippets).
Am I missing something here?
I am trying to get the below action to display on an archive page on my site via Code Snippets:
add_action( 'woocommerce_after_shop_loop', 'test_text', 42);
function test_text() {
the_field('group_5f7ee777725c8', 42);
}
This is a hook for Advanced Custom Fields to display some basic text on an archive page (product_cat), ACF support say that this should work - but I cannot get it to display. ACF support have stressed that I need to look at how I am implementing this code, but I can see nothing wrong with implementing this how I am trying (Code Snippets).
Am I missing something here?
Share Improve this question edited Oct 20, 2020 at 9:19 Rup 4,4004 gold badges29 silver badges29 bronze badges asked Oct 20, 2020 at 7:00 DanDan 1 2- What is the field named "group_5f7ee777725c8"? And is there a post with ID: 42? – vadims Commented Oct 20, 2020 at 9:05
- I don't know Code Snippets: where does it run? Will this hook definitely be in place before it's called? You could e.g. add an error_log or some other echo to the code to verify it is actually called. Can you try editing this into your theme's functions.php temporarily to see if that works instead? – Rup Commented Oct 20, 2020 at 9:20
1 Answer
Reset to default 0You try to access to an ACF group of fields
group_5f7ee777725c8
and the function the_field
need a field key (not the group key).
You shoud replace group_5f7ee777725c8
with the field key you'll find inside the group. So in ACF menu click on the group group_5f7ee777725c8
and find the field key. It should start with field_XXXXX
本文标签: themesI cannot get an Advanced Custom Field code snippet to workand ACF support say it should work
版权声明:本文标题:themes - I cannot get an Advanced Custom Field code snippet to work - and ACF support say it should work 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742024917a2415359.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论