Results 1 to 7 of 7

Thread: How to Add Custom Taxonomies to Create/Edit Listing Form (form-listing.php)?

  1. #1
    Thread Starter
    Expired Customer sjs719's Avatar
    Join Date
    May 2015
    Posts
    26
    Thanks
    1
    Thanked 1 Time in 1 Post

    How to Add Custom Taxonomies to Create/Edit Listing Form (form-listing.php)?

    I have searched the forums and docs for this subject but cannot find any solutions. I want to add a few custom taxonomies to the "Create Listing" form for frontend users to input while creating a new listing. I can display the custom taxonomies just fine by adding the proper code to the form-listing.php file, but the custom taxonomies are not saved to the listing when the user submits the listing. For example, I have registered the custom taxonomy "Business Hours" for the custom post type 'listings' via the functions.php file and I can display this taxonomy as a dropdown within the create listing form using the function
    Code:
    wp_dropdown_categories
    but when the user submits the form the "Business Hours" field in the single listing page is empty.

    Here is the full dropdown function:

    Code:
    <div class="form-field">
    <?php wp_dropdown_categories( array(
    'taxonomy' => 'bhours',
    'hide_empty' => false,
    'hierarchical' => true,
    'name' => 'bhours',
    'id' => 'bhours',
    'selected' => $listing-> bhours,
    'show_option_none' => __( 'Business Hours:', APP_TD ),
    'class' => 'required',
    'orderby' => 'name',
    'include' => $listing_cat,
    'hide_if_empty' => false,
    ) ); ?>
    </div>
    The same thing happens when I display the custom taxonomy as a text field using the following function:

    Code:
    <label>
    			<?php _e( 'Business Hours', APP_TD ); ?>
    			<input id="listing-bhours" name="bhours" type="text" value="<?php echo esc_attr( $listing->bhours ); ?>" class="required" />
    		</label>
    The only way I have been able to get the custom taxonomy entered in the create listing form to actually populate the correct field within the single listing page is by making a Walker checkbox as follows:

    Code:
    <?php
    $args = array(
        	'taxonomy' => 'bhours',
    	'title_li' => '',
        	'walker'   => New Walker_Category_Checklist,
    	'hide_empty' => false,
        	'checked_ontop' => false,
    );
    ?>
    
    <ul class="categorieschecklist">
    <?php wp_list_categories( $args ); ?>
    </ul>
    But I don't want to have to use a checkbox for all of my custom taxonomies which I want to include in the create listing form. So why does the data correctly save and display when I use the Walker function, but the same data will not save and display if I use any other function such as
    Code:
    wp_dropdown_categories
    or a radio or text field?
    Last edited by sjs719; June 17th, 2015 at 05:51 PM. Reason: typo

  2. #2
    dikiyforester's Avatar
    Join Date
    Oct 2011
    Location
    Russian Federation
    Posts
    2,229
    Thanks
    89
    Thanked 593 Times in 491 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  3. The Following User Says Thank You to dikiyforester For This Useful Post:

    sjs719 (June 18th, 2015)

  4. #3
    Thread Starter
    Expired Customer sjs719's Avatar
    Join Date
    May 2015
    Posts
    26
    Thanks
    1
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #4
    Expired Customer northampton's Avatar
    Join Date
    Jan 2014
    Location
    Europe
    Posts
    356
    Thanks
    77
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  6. #5
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. The Following User Says Thank You to dimitris For This Useful Post:

    northampton (December 27th, 2015)

  8. #6
    Expired Customer northampton's Avatar
    Join Date
    Jan 2014
    Location
    Europe
    Posts
    356
    Thanks
    77
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  9. #7
    dimitris's Avatar
    Join Date
    Oct 2011
    Location
    Earth
    Posts
    20,617
    Thanks
    222
    Thanked 1,873 Times in 1,770 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Bypass create listing page and use custom create listing form
    By miketheappguy in forum Vantage General Discussion (Legacy)
    Replies: 2
    Last Post: April 23rd, 2016, 09:34 PM
  2. Dimitris How to Edit Create Listing Form on Vantage Theme
    By helderbn in forum Vantage General Discussion (Legacy)
    Replies: 1
    Last Post: March 14th, 2015, 07:24 AM
  3. Dimitris How to Edit Create Listing Form on Vantage Theme
    By helderbn in forum Report Vantage Bugs (Legacy)
    Replies: 1
    Last Post: March 14th, 2015, 07:24 AM
  4. Custom Fields Not Showing Up on Create Listing Form
    By manilaboy in forum Report Vantage Bugs (Legacy)
    Replies: 37
    Last Post: July 1st, 2013, 06:40 AM
  5. Can't remove maps AND have working custom form fields on Create a Listing Page
    By eqmarketing in forum Vantage General Discussion (Legacy)
    Replies: 4
    Last Post: May 17th, 2013, 10:53 AM