Inventory_Presser_Admin_Location_Meta::edit_location_field( WP_Term $term )
Outputs HTML that renders additional fields for the edit term screen.
On This Page
Parameters Parameters
- $term
-
(WP_Term) (Required) Current taxonomy term object.
Return Return
(void)
Source Source
File: includes/admin/class-admin-location-meta.php
public function edit_location_field( $term ) { $meta = get_term_meta( $term->term_id ); ?> <tr class="form-field term-group-wrap"> <th scope="row"> <label><?php esc_html_e( 'Street Address', 'inventory-presser' ); ?></label> </th> <td> <input type="text" name="address_street" value="<?php echo esc_attr( $meta['address_street'][0] ?? '' ); ?>" /> </td> </tr> <tr class="form-field term-group-wrap"> <th scope="row"> <label><?php esc_html_e( 'Street Address line two', 'inventory-presser' ); ?></label> </th> <td> <input type="text" name="address_street_line_two" value="<?php echo esc_attr( $meta['address_street_line_two'][0] ?? '' ); ?>" /> </td> </tr> <tr class="form-field term-group-wrap"> <th scope="row"> <label><?php esc_html_e( 'City', 'inventory-presser' ); ?></label> </th> <td> <input type="text" name="address_city" value="<?php echo esc_attr( $meta['address_city'][0] ?? '' ); ?>" /> </td> </tr> <tr class="form-field term-group-wrap"> <th scope="row"> <label><?php esc_html_e( 'State', 'inventory-presser' ); ?></label> </th> <td> <input type="text" name="address_state" value="<?php echo esc_attr( $meta['address_state'][0] ?? '' ); ?>" /> </td> </tr> <tr class="form-field term-group-wrap"> <th scope="row"> <label><?php esc_html_e( 'Zip', 'inventory-presser' ); ?></label> </th> <td> <input type="text" name="address_zip" value="<?php echo esc_attr( $meta['address_zip'][0] ?? '' ); ?>" /> </td> </tr> </tbody> </table> <h2 class="title"><?php esc_html_e( 'Phone Numbers & Hours', 'inventory-presser' ); ?></h2> <table class="form-table" role="presentation"> <tbody> <tr class="form-field term-group-wrap"> <th scope="row"><label><?php esc_html_e( 'Phone Numbers', 'inventory-presser' ); ?></label></th> <td> <div class="repeat-group"> <div class="repeat-container"> <?php $phones = INVP::get_phones( $term->term_id ); if ( ! empty( $phones ) ) { foreach ( $phones as $phone ) { ?> <div class="repeated"> <div class="repeat-form"> <?php printf( '<input type="hidden" name="phone_uid[]" value="%s" />' . '<input type="text" name="phone_description[]" value="%s" placeholder="%s" />' . '<input type="text" name="phone_number[]" value="%s" placeholder="%s" />', esc_attr( $phone['uid'] ), esc_attr( $phone['description'] ), esc_attr__( 'Label', 'inventory-presser' ), esc_attr( $phone['number'] ), esc_attr__( 'Number', 'inventory-presser' ) ); ?> </div> <div class="repeat-buttons"> <span class="dashicons dashicons-menu repeat-move"></span> <span class="dashicons dashicons-trash repeat-delete"></span> </div> </div> <?php } } ?> </div> <div class="repeat-this"> <div class="repeat-form"> <input type="text" name="phone_description[]" placeholder="<?php esc_attr_e( 'Label', 'inventory-presser' ); ?>" /> <input type="text" name="phone_number[]" placeholder="<?php esc_attr_e( 'Number', 'inventory-presser' ); ?>" /> </div> <div class="repeat-buttons"> <span class="dashicons dashicons-menu repeat-move" title="<?php esc_attr_e( 'Drag to reposition', 'inventory-presser' ); ?>"></span> <span class="dashicons dashicons-trash repeat-delete" title="<?php esc_attr_e( 'Delete this set of hours', 'inventory-presser' ); ?>"></span> </div> </div> <button type="button" class="repeat-add button action"><?php esc_html_e( 'Add Phone Number', 'inventory-presser' ); ?></button> </div> </td> </tr> <tr class="form-field term-group-wrap"> <th scope="row"><label><?php esc_html_e( 'Hours', 'inventory-presser' ); ?></label></th> <td> <div class="repeat-group"> <div class="repeat-container"> <?php $hours_sets = INVP::get_hours( $term->term_id ); $days = array_keys( INVP::weekdays() ); if ( ! empty( $hours_sets ) ) { foreach ( $hours_sets as $hours ) { ?> <div class="repeated"> <div class="repeat-form"> <input type="text" name="hours_title[]" placeholder="<?php esc_attr_e( 'Title', 'inventory-presser' ); ?>" value="<?php echo esc_attr( $hours['title'] ); ?>" /> <input type="hidden" name="hours_uid[]" placeholder="<?php esc_attr_e( 'Title', 'inventory-presser' ); ?>" value="<?php echo esc_attr( $hours['uid'] ); ?>" /> <table class="repeater-table hours"> <thead> <th class="day-col"></th> <th><?php esc_html_e( 'Open', 'inventory-presser' ); ?></th> <th class="to-col"></th> <th><?php esc_html_e( 'Close', 'inventory-presser' ); ?></th> <th><abbr title="<?php esc_attr_e( 'Appointment', 'inventory-presser' ); ?>"><?php esc_html_e( 'Appt', 'inventory-presser' ); ?></abbr> <?php echo esc_html_e( 'Only', 'inventory-presser' ); ?></th> </thead> <tbody> <?php for ( $d = 0; $d < 7; $d++ ) { ?> <tr> <td><?php echo esc_html( ucfirst( substr( $days[ $d ], 0, 3 ) ) ); ?></td> <td><input name="hours[<?php echo esc_attr( $d ); ?>][open][]" class="timepick" type="text" value="<?php echo esc_attr( $hours[ $days[ $d ] . '_open' ] ); ?>"></td> <td>to</td> <td><input name="hours[<?php echo esc_attr( $d ); ?>][close][]" class="timepick" type="text" value="<?php echo esc_attr( $hours[ $days[ $d ] . '_close' ] ); ?>"></td> <td> <select name="hours[<?php echo esc_attr( $d ); ?>][appt][]" autocomplete="off"> <option value="0"<?php echo ( '0' === $hours[ $days[ $d ] . '_appt' ] ) ? ' selected' : ''; ?>><?php esc_html_e( 'No', 'inventory-presser' ); ?></option> <option value="1"<?php echo ( '1' === $hours[ $days[ $d ] . '_appt' ] ) ? ' selected' : ''; ?>><?php esc_html_e( 'Yes', 'inventory-presser' ); ?></option> </select> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="repeat-buttons"> <span class="dashicons dashicons-menu repeat-move" title="<?php esc_attr_e( 'Drag to reposition', 'inventory-presser' ); ?>"></span> <span class="dashicons dashicons-trash repeat-delete" title="<?php esc_attr_e( 'Delete this set of hours', 'inventory-presser' ); ?>"></span> </div> </div> <?php } } ?> </div> <div class="repeat-this"> <div class="repeat-form"> <input type="text" name="hours_title[]" placeholder="Title" /> <table class="repeater-table hours"> <thead> <th class="day-col"></th> <th><?php esc_html_e( 'Open', 'inventory-presser' ); ?></th> <th class="to-col"></th> <th><?php esc_html_e( 'Close', 'inventory-presser' ); ?></th> <th><abbr title="<?php esc_attr_e( 'Appointment', 'inventory-presser' ); ?>"><?php esc_html_e( 'Appt', 'inventory-presser' ); ?></abbr> <?php esc_html_e( 'Only', 'inventory-presser' ); ?></th> </thead> <tbody> <?php foreach ( array_keys( INVP::weekdays() ) as $d => $day ) { ?> <tr> <td><?php echo esc_html( ucfirst( substr( $days[ $d ], 0, 3 ) ) ); ?></td> <td><input name="hours[<?php echo esc_attr( $d ); ?>][open][]" class="timepick" type="text"></td> <td>to</td> <td><input name="hours[<?php echo esc_attr( $d ); ?>][close][]" class="timepick" type="text"></td> <td> <select name="hours[<?php echo esc_attr( $d ); ?>][appt][]"> <option value="0"><?php esc_html_e( 'No', 'inventory-presser' ); ?></option> <option value="1"><?php esc_html_e( 'Yes', 'inventory-presser' ); ?></option> </select> </td> </tr> <?php } ?> </tbody> </table> </div> <div class="repeat-buttons"> <span class="dashicons dashicons-menu repeat-move"></span> <span class="dashicons dashicons-trash repeat-delete"></span> </div> </div> <p class="description"><?php esc_html_e( 'When saving multiple sets of hours for a single location, position the primary showroom hours first.', 'inventory-presser' ); ?></p> <p><button type="button" class="repeat-add button action"><?php esc_html_e( 'Add Hours Set', 'inventory-presser' ); ?></button></p> </div> </td> </tr> <?php }
Expand full source codeCollapse full source codeView on Github