篇首语:本文由小常识网(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:添加属性自定义元字段的主要内容,如果未能解决你的问题,请参考以下文章