admin管理员组文章数量:1278859
I want to create a wordpress plugin which is be able to load the values of the parent pages ACF Fields into the Values of the subpages. Is there a way to do that? At the moment I have the code to get the parent page ID and to check, if the ACF Checkbox is active:
<?php
function em_get_parent_page_id()
{
$post = get_post();
$post_id = $post->ID ?? null;;
$parent_post_id = $post->post_parent ?? null;
return $parent_post_id > 0 ? $parent_post_id : $post_id;
}
function em_is_parent_menu_enabled($post_id)
{
$is_active = get_field('parent_aktiv', $post_id)[0] ?? null;
return $is_active === 'active' ? true : false;
}
本文标签: phpCreate ACF Checkbox to get all ACF Values from Parent Page
版权声明:本文标题:php - Create ACF Checkbox to get all ACF Values from Parent Page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741263533a2368047.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论