【发布时间】:2020-07-27 00:44:28
【问题描述】:
我正在尝试向 edit.php 页面(帖子列表页面)添加一些自定义字段 这是一些设置,例如询问用户帖子是否必须显示在 2,3 或 4 列 w 中,我特别希望在此页面上显示。
我找到了一种无需编辑 wp-admin/edit.php 或 wp-admin/custom-header.php 即可将内容添加到正确位置的方法
add_action( 'load-edit.php', function(){
$screen = get_current_screen();
if( 'edit-post' === $screen->id )
{
add_action( 'all_admin_notices', function(){
echo '<h2> === Add ACF Fields here === </h2>';
});
});
我也在 ACF 中添加位置规则的一半:
add_filter('acf/location/rule_types', 'acf_location_rules_types');
function acf_location_rules_types( $choices ) {
$choices['Post']['post_edit_screen'] = 'Post Edit Screen';
return $choices;
}
但是现在如何创建位置规则以在此处显示我的 ACF 字段?
【问题讨论】:
标签: advanced-custom-fields acfpro