/** * Renders the form fields on the term edit page */ function display_fields($term) { if (!in_array($term->taxonomy, $this->get_sidebar_taxonomies())) { // abort if the term doesn't belong to the taxonomies to have icons return; } //get the proxy post id $post_id = largo_get_term_meta_post($term->taxonomy, $term->term_id); $current_value = largo_get_term_meta($term->taxonomy, $term->term_id, 'custom_sidebar', true); ?> <tr class="form-field"> <th scope="row" valign="top"><label for="custom_sidebar"><?php _e('Archive Sidebar', 'largo'); ?> </label></th> <td> <select name="custom_sidebar" id="custom_sidebar" style="min-width: 300px;"> <?php largo_custom_sidebars_dropdown($current_value, false, $post_id); //get the options ?> </select> <br/> <p class="description"><?php _e("The sidebar to display on this term's archive page.", 'largo'); ?> </p> <?php wp_nonce_field('custom_sidebar-' . $term->term_id, '_custom_sidebar_nonce'); ?> </td> </tr> <?php }
/** * Retrieve the icon information for a term * * @param term|string $taxonomy_or_term - the term object of the taxonomy name * @param int $term_id - the term id when the first parameter is the taxonomy name */ function get_icon($taxonomy_or_term, $term_id = '') { if (is_object($taxonomy_or_term)) { $term = $taxonomy_or_term; } else { $term = get_term($taxonomy_or_term, $term_id); } $uid = largo_get_term_meta($term->taxonomy, $term->term_id, 'associated_icon_uid', true); $config = $this->get_icons_config(); foreach ($config->glyphs as $glyph) { if ($glyph->uid == $uid) { return $glyph; } } return false; }
/** * Returns slug of custom sidebar that should be used */ function largo_get_custom_sidebar() { $custom_sidebar = false; if (is_singular()) { $custom_sidebar = get_post_meta(get_the_ID(), 'custom_sidebar', true); if (in_array($custom_sidebar, array('', 'default'))) { $custom_sidebar = 'none'; } } else { if (is_archive()) { $term = get_queried_object(); $custom_sidebar = largo_get_term_meta($term->taxonomy, $term->term_id, 'custom_sidebar', true); } } return $custom_sidebar; }