Editing form-listing.php to place custom fields in logical places. (need some help)
Hello,
I am trying to customise the form-listing.php so the create listing and edit listing pages will have a logical field entry order. I can't seem to get custom fields to update though. The field and field content shows up but if it is edited and submitted the changes do not take effect. Any ideas would be greatly appreciated.
Here is the code:
<?php global $va_options; ?>
<div id="main">
<?php do_action( 'appthemes_notices' ); ?>
<div class="section-head">
<h1><?php echo $title; ?></h1>
</div>
<form id="create-listing" enctype="multipart/form-data" method="post" action="<?php echo $form_action; ?>">
<?php wp_nonce_field( 'va_create_listing' ); ?>
<input type="hidden" name="action" value="<?php echo ( get_query_var('listing_edit') ? 'edit-listing' : 'new-listing' ); ?>" />
<input type="hidden" name="ID" value="<?php echo esc_attr( $listing->ID ); ?>" />
<fieldset id="essential-fields">
<div class="featured-head"><h3><?php _e( 'Listing Essentials (Required)', APP_TD ); ?></h3></div>
<?php
// if categories are locked display only the current listing category
if ( va_categories_locked() )
$listing_cat = $listing->category;
else
$listing_cat = array();
?>
<fieldset id="category-fields">
<div class="form-field"><label>
<?php _e( 'Category', APP_TD ); ?>
<?php wp_dropdown_categories( array(
'taxonomy' => VA_LISTING_CATEGORY,
'hide_empty' => false,
'hierarchical' => true,
'name' => '_'.VA_LISTING_CATEGORY,
'selected' => $listing->category,
'show_option_none' => __( 'Select Category', APP_TD ),
'class' => 'required',
'orderby' => 'name',
'include' => $listing_cat
) ); ?>
</label></div>
</fieldset>
<div class="form-field"><label>
<?php _e( 'Business Name', APP_TD ); ?>
<input name="post_title" type="text" value="<?php echo esc_attr( $listing->post_title ); ?>" class="required" />
</label></div>
<div class="form-field">
<?php $coord = appthemes_get_coordinates( $listing->ID ); ?>
<input name="lat" type="hidden" value="<?php echo esc_attr( $coord->lat ); ?>" />
<input name="lng" type="hidden" value="<?php echo esc_attr( $coord->lng ); ?>" />
<label>
<?php _e( 'Location (street address, city, state)', APP_TD ); ?>
<input id="listing-address" name="address" type="text" value="<?php echo esc_attr( $listing->address ); ?>" class="required" />
</label>
<input id="listing-find-on-map" type="button" value="<?php esc_attr_e( 'Find on map', APP_TD ); ?>">
<div id="listing-map"></div>
</div>
</fieldset>
<fieldset id="contact-fields">
<div class="featured-head"><h3><?php _e( 'Regular Options', APP_TD ); ?></h3></div>
<div class="form-field phone"><label>
<?php _e( 'Phone Number', APP_TD ); ?>
<input name="phone" type="text" value="<?php echo esc_attr( $listing->phone ); ?>" />
</label></div>
<div class="form-field phone"><label>
<?php _e( 'Fax Number', APP_TD ); ?>
<input name="app_fax" type="text" value="<?php echo esc_attr( $listing->app_fax ); ?>" />
</label></div>
<div class="form-field phone"><label>
<?php _e( 'Email', APP_TD ); ?>
<input name="app_email" type="text" value="<?php echo esc_attr( $listing->app_email ); ?>" />
</label></div>
<div class="form-field listing-urls web">
<label>
<?php _e( 'Website', APP_TD ); ?><br />
<span>http://</span><input name="website" type="text" value="<?php echo esc_attr( $listing->website ); ?>" />
</label>
</div>
<div class="form-field"><label>
<?php _e( 'Hours', APP_TD ); ?>
<input name="app_hours" type="text" value="<?php echo esc_attr( $listing->app_hours ); ?>" />
</label></div>
<div class="featured-head"><h3><?php _e( 'Bold Listings Options', APP_TD ); ?></h3></div>
<fieldset id="misc-fields">
<div class="form-field images">
<?php _e( 'Listing Images', APP_TD ); ?>
<?php the_listing_image_editor( $listing->ID ); ?>
</div>
<div class="form-field"><label>
<?php _e( 'Business Description', APP_TD ); ?>
<textarea name="post_content"><?php echo esc_textarea( $listing->post_content ); ?></textarea>
</label></div>
<div class="form-field"><label>
<?php _e( 'Tags', APP_TD ); ?>
<input name="tax_input[<?php echo VA_LISTING_TAG; ?>]" type="text" value="<?php the_listing_tags_to_edit( $listing->ID ); ?>" />
</label></div>
</fieldset>
<div class="form-field phone"><label>
<?php _e( 'Skype (username)', APP_TD ); ?>
<input name="app_skype" type="text" value="<?php echo esc_attr( $listing->app_skype ); ?>" />
</label></div>
<div class="form-field listing-urls facebook">
<label>
<?php _e( 'Facebook', APP_TD ); ?>
<span>facebook.com/</span><input name="facebook" type="text" value="<?php echo esc_attr( $listing->facebook ); ?>" />
</label>
</div>
</fieldset>
<div class="form-field listing-urls twitter">
<label>
<?php _e( 'Twitter', APP_TD ); ?>
<span>@</span><input name="twitter" type="text" value="<?php echo esc_attr( $listing->twitter ); ?>" />
</label>
</div>
<fieldset id="category-fields">
<div id="custom-fields">
<div class="form-field"><label>
<?php _e( 'Blog (link)', APP_TD ); ?>
<input name="app_blog" type="text" value="<?php echo esc_attr( $listing->app_blog ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'RSS Feed (link)', APP_TD ); ?>
<input name="app_rss" type="text" value="<?php echo esc_attr( $listing->app_rss ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'LinkedIn (link)', APP_TD ); ?>
<input name="app_linkedin" type="text" value="<?php echo esc_attr( $listing->app_linkedin ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'YouTube (link)', APP_TD ); ?>
<input name="app_youtube" type="text" value="<?php echo esc_attr( $listing->app_youtube ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'Google+ (link)', APP_TD ); ?>
<input name="app_googleplus" type="text" value="<?php echo esc_attr( $listing->app_googleplus ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'Pinterest (link)', APP_TD ); ?>
<input name="app_pinterest" type="text" value="<?php echo esc_attr( $listing->app_pinterest ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'Vimeo (link)', APP_TD ); ?>
<input name="app_vimeo" type="text" value="<?php echo esc_attr( $listing->app_vimeo ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'Podcasts (link)', APP_TD ); ?>
<input name="app_podcasts" type="text" value="<?php echo esc_attr( $listing->app_podcasts ); ?>" />
</label></div>
<div class="form-field"><label>
<?php _e( 'Yahoo Group (link)', APP_TD ); ?>
<input name="app_yahoogroups" type="text" value="<?php echo esc_attr( $listing->app_yahoogroups ); ?>" />
</label></div>
</fieldset>
<fieldset id="category-fields">
<div id="custom-fields">
<?php
if ( $listing->category ) {
the_listing_files_editor( $listing->ID );
va_render_form( (int) $listing->category, $listing->ID );
}
?>
</div>
</fieldset>
<?php do_action( 'va_after_create_listing_form' ); ?>
<fieldset>
<div class="form-field"><input type="submit" value="<?php echo esc_attr( $action ); ?>" /></div>
</fieldset>
</form>
</div><!-- #content -->
</div><!-- /#main -->
<div id="sidebar">
<?php dynamic_sidebar( 'create-listing' ); ?>
</div>