Taxonomy button
-
Hi, I am hoping to get a little bit of insight I have built a form for property submission. But when a user edits the property listing this button that works with taxonomy, it shows no as default even if selected.
Heres what happens the submit listing and edit listing are two separate pages on front end. when a listing is submitted the data all gets stored ok. But if the user wants to edit the listing the term options don’t show correctly.
So if when i submitted this property i select eg. Studio Flat so it shows yes. When i saved it goes in Taxonomy like it should. But when user goes to edit the listing and wishes to use a different term or remove from term so when No is selected remove for term.
Hope someone can help, code is below thank you
Listing Page:
<div class="col span_4 first"> <label><?php esc_html_e('Studio Flat', 'contempo'); ?></label> <select id="ct_studio_flat_type" name="ct_studio_flat_type"> <option value="">No</option> <option value="studio-flat">Yes</option> </select> </div>
Edit Listing Page:
<div class="col span_4 first"> <label><?php esc_html_e('Studio Flat', 'contempo'); ?></label> <?php $taxonomy_name = 'ct_property_type'; $name = strip_tags( get_the_term_list( $current_post, 'ct_property_type', '', ', ', '' ) ); ?> <select id="ct_studio_flat_type" name="ct_studio_flat_type"> <option value="">No</option> <option value="studio-flat" <?php if($name == 'Studio Flat') { echo 'selected="selected" '; } ?>>Yes</option> </select> </div>
- The topic ‘Taxonomy button’ is closed to new replies.