Hi,
please try the code below it will remove price and location fields, and add Rates header, In Call, Out Call and Overnight fields to the form. It will also display them on Ad details page.
add_filter( "adverts_form_load", "cockyclub_customize_adverts_add" );
function cockyclub_customize_adverts_add( $form ) {
if( $form['name'] != "advert" ) {
return $form;
}
foreach( $form["field"] as $key => $field ) {
if( in_array( $field["name"], array( "adverts_price", "adverts_location" ) ) ) {
unset( $form["field"][$key] );
}
}
$form["field"][] = array(
"name" => "_rates",
"type" => "adverts_field_header",
"order" => 25,
"label" => __( 'Rates', 'adverts' )
);
$form["field"][] = array(
"name" => "incall",
"type" => "adverts_field_text",
"order" => 25,
"label" => "In Call",
"is_required" => true,
"validator" => array(
array( "name" => "is_required" ),
)
);
$form["field"][] = array(
"name" => "outcall",
"type" => "adverts_field_text",
"order" => 25,
"label" => "Out Call",
"is_required" => true,
"validator" => array(
array( "name" => "is_required" ),
)
);
$form["field"][] = array(
"name" => "overnight",
"type" => "adverts_field_text",
"order" => 25,
"label" => "Overnight",
"is_required" => true,
"validator" => array(
array( "name" => "is_required" ),
)
);
return $form;
}
add_action( "adverts_tpl_single_details", "cockyclub_adverts_tpl_single_details" );
function cockyclub_adverts_tpl_single_details( $post_id ) {
$inc = get_post_meta( $post_id, "incall", true);
$out = get_post_meta( $post_id, "outcall", true);
$ove = get_post_meta( $post_id, "overnight", true);
?>
<?php if(! empty($inc) || ! empty($out) || ! empty($ove) ): ?>
<div class="adverts-grid-row">
<div class="adverts-grid-col adverts-col-30">
<span class="adverts-round-icon adverts-icon-wordpress"></span>
<span class="adverts-row-title">Rates</span>
</div>
<div class="adverts-grid-col adverts-col-65">
<?php esc_html_e( $inc ) ?> - <?php esc_html_e( $out ) ?> - <?php esc_html_e( $ove ) ?>
</div>
</div>
<?php endif; ?>
<?php
}