ID : $thepostid;
$field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$field['type'] = isset( $field['type'] ) ? $field['type'] : 'text';
$data_type = empty( $field['data_type'] ) ? '' : $field['data_type'];
switch ( $data_type ) {
case 'price' :
$field['class'] .= ' ph_input_price';
$field['value'] = ph_format_localized_price( $field['value'] );
break;
case 'decimal' :
$field['class'] .= ' ph_input_decimal';
$field['value'] = ph_format_localized_decimal( $field['value'] );
break;
}
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) )
foreach ( $field['custom_attributes'] as $attribute => $value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
echo '
';
if ( ! empty( $field['description'] ) ) {
if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) {
echo '
';
} else {
echo '' . wp_kses_post( $field['description'] ) . '';
}
}
echo '
';
}
/**
* Output a file input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_photo_upload( $field ) {
global $thepostid, $post, $propertyhive;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['id'] = isset( $field['id'] ) ? $field['id'] : '';
$field['button_label'] = isset( $field['button_label'] ) ? $field['button_label'] : __('Select Photo', 'propertyhive');
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$data_type = empty( $field['data_type'] ) ? '' : $field['data_type'];
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) )
foreach ( $field['custom_attributes'] as $attribute => $value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
propertyhive_wp_hidden_input( $field );
echo '
';
if ( $field['value'] != '' )
{
$image = wp_get_attachment_image_src( $field['value'], 'thumbnail' );
if ($image !== FALSE)
{
echo '
';
}
else
{
echo 'Image doesn\'t exist';
}
}
echo '
';
echo '
' . $field['button_label'] . '';
if ( ! empty( $field['description'] ) ) {
if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) {
echo '
';
} else {
echo '' . wp_kses_post( $field['description'] ) . '';
}
}
echo '
';
echo '';
}
/**
* Output a hidden input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_hidden_input( $field ) {
global $thepostid, $post;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
echo ' ';
}
/**
* Output a textarea input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_textarea_input( $field ) {
global $thepostid, $post, $propertyhive;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['placeholder'] = isset( $field['placeholder'] ) ? $field['placeholder'] : '';
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
// Custom attribute handling
$custom_attributes = array();
if ( ! empty( $field['custom_attributes'] ) && is_array( $field['custom_attributes'] ) )
foreach ( $field['custom_attributes'] as $attribute => $value )
$custom_attributes[] = esc_attr( $attribute ) . '="' . esc_attr( $value ) . '"';
echo ' ';
if ( ! empty( $field['description'] ) ) {
if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) {
echo '
';
} else {
echo '' . wp_kses_post( $field['description'] ) . '';
}
}
echo '
';
}
/**
* Output a checkbox input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_checkbox( $field ) {
global $thepostid, $post;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['cbvalue'] = isset( $field['cbvalue'] ) ? $field['cbvalue'] : 'yes';
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
echo ' ';
if ( ! empty( $field['description'] ) ) echo '' . wp_kses_post( $field['description'] ) . '';
echo '
';
}
/**
* Output a groupd of checkbox input boxes.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_checkboxes( $field ) {
global $thepostid, $post;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'checkbox';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['name'], true );
echo '';
}
/**
* Output a select input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_select( $field ) {
global $thepostid, $post, $propertyhive;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
echo ' ';
if ( ! empty( $field['description'] ) ) {
if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) {
echo '
';
} else {
echo '' . wp_kses_post( $field['description'] ) . '';
}
}
echo '
';
}
/**
* Output a select input box with optgroups.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_select_optgroups( $field ) {
global $thepostid, $post, $propertyhive;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
echo ' ';
if ( ! empty( $field['description'] ) ) {
if ( isset( $field['desc_tip'] ) && false !== $field['desc_tip'] ) {
echo '
';
} else {
echo '' . wp_kses_post( $field['description'] ) . '';
}
}
echo '
';
}
/**
* Output a radio input box.
*
* @access public
* @param array $field
* @return void
*/
function propertyhive_wp_radio( $field ) {
global $thepostid, $post, $propertyhive;
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['value'] = isset( $field['value'] ) ? $field['value'] : get_post_meta( $thepostid, $field['id'], true );
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
echo '';
}