public static function change_title($data, $postarr) { // If it is our form has not been submitted, so we dont want to do anything if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) { return; } if (!empty($data['post_title'])) { return $data; } $kind_strings = Kind_Taxonomy::get_strings(); $kind = get_term_by(taxonomy_id, $_POST['tax_input']['kind'], 'kind'); $title = $kind_strings[$kind->slug]; if (!empty($_POST['cite_name'])) { $title .= ' - ' . $_POST['cite_name']; } $data['post_title'] = $title; $data['post_name'] = sanitize_title($data['post_title']); return $data; }
/** * Generate a Term List. * * @access public */ public static function termlist_callback() { $options = get_option('iwt_options', array()); $terms = Kind_Taxonomy::get_strings(); // Hide these terms until ready for use for now. $hide = array('note', 'weather', 'exercise', 'travel', 'rsvp', 'tag', 'follow', 'drink', 'eat'); // Hide checkin option unless Simple Location is active. if (!class_exists('loc_config')) { $hide[] = 'checkin'; } foreach ($hide as $hid) { unset($terms[$hid]); } if (!array_key_exists('termslists', $options)) { $termslist = array(); } else { $termslist = $options['termslists']; } echo '<select id="termslists" name="iwt_options[termslists][]" multiple>'; foreach ($terms as $key => $value) { echo '<option value="' . $key . '" ' . selected(in_array($key, $termslist)) . '>' . $value . '</option>'; } echo '</select>'; }