在帖子标题下添加自定义域

时间:2018-06-26 作者:Nemus

我为WooCommerce产品添加了自定义文本字段:

if(function_exists("register_field_group"))
{
    register_field_group(array (
        \'id\' => \'acf_products\',
        \'title\' => \'Products\',
        \'fields\' => array (
            array (
                \'key\' => \'field_5b31fba49dfe8\',
                \'label\' => \'Product Long Title\',
                \'name\' => \'product_long_title\',
                \'type\' => \'text\',
                \'default_value\' => \'\',
                \'placeholder\' => \'Enter <br/> tag here\',
                \'prepend\' => \'\',
                \'append\' => \'\',
                \'formatting\' => \'html\',
                \'maxlength\' => \'\',
            ),
        ),
        \'location\' => array (
            array (
                array (
                    \'param\' => \'post_type\',
                    \'operator\' => \'==\',
                    \'value\' => \'product\',
                    \'order_no\' => 0,
                    \'group_no\' => 0,
                ),
            ),
        ),
        \'options\' => array (
            \'position\' => \'normal\',
            \'layout\' => \'no_box\',
            \'hide_on_screen\' => array (
            ),
        ),
        \'menu_order\' => 0,
    ));
}
我希望它出现在产品标题下,如图片上的下划线所示。

enter image description here

我如何才能做到这一点?谢谢

1 个回复
SO网友:Krzysiek Dróżdż

这个position param对此负责。您可以找到包含描述的所有参数here.

因此,您必须更改代码的这一部分:

    \'options\' => array (
        \'position\' => \'normal\',
        \'layout\' => \'no_box\',
        \'hide_on_screen\' => array (
        ),
    ),
对此:

    \'options\' => array (
        \'position\' => \'acf_after_title\',
        \'layout\' => \'no_box\',
        \'hide_on_screen\' => array (
        ),
    ),

结束

相关推荐