php Real Homes:添加属性自定义元字段

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了php Real Homes:添加属性自定义元字段相关的知识,希望对你有一定的参考价值。

<?php
/**
 * Add property custom meta fields
 */
function add_property_custom_fields( $new_fields ) {
 
    $new_fields['tab'] = array(
        'label' => 'Custom Tab', // tab name
        'icon'  => 'dashicons-admin-generic' // tab icon class (of dashicon). See all dashicons here: https://developer.wordpress.org/resource/dashicons
    );
 
    $new_fields['fields'] = array(
        array(
            'name'    => 'Year Built', // field name
            'desc'    => 'Example Value: 12-06-2016', // field description
            'postfix' => '', // field postfix (if any)
            'icon'    => 'year', // Place “png” icon in "realhomes/assets/(variation you are using)/icons" directory. Retina (double sized) icons should use @2x as postfix with icon name. E.g: year.png, year@2x.png
            'columns' => 6, // use ‘6’ for two fields in one row and ’12’ for one field in one row
            'display' => true // true to display field value on property detail page, otherwise false
        ),
        array(
            'name'    => 'Plot Size', // field name
            'desc'    => 'Example Value: 300', // field description
            'postfix' => 'SqFt', // field postfix (if any)
            'icon'    => 'size', // Place “png” icon in "realhomes/assets/(variation you are using)/icons" directory. Retina (double sized) icons should use @2x as postfix with icon name. E.g: year.png, year@2x.png
            'columns' => 6, // use ‘6’ for two fields in one row and ’12’ for one field in one row
            'display' => true // true to display field value on property detail page, otherwise false
        ),
    );
 
    return $new_fields;
}
 
add_filter( 'inspiry_property_custom_fields', 'add_property_custom_fields' );

以上是关于php Real Homes:添加属性自定义元字段的主要内容,如果未能解决你的问题,请参考以下文章

php 在帖子中添加元变量(自定义字段,ej template-slug)#wordpress

Mac OS X:向任何文件添加自定义元数据字段

将自定义结帐字段(用户输入)添加到订单数据和用户元数据

自定义元框 Save_Post 回调未在 functions.php 中触发

php 自定义元字段的自定义帖子类型

PHP 插入自定义字段元