/** * 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 }
/** * Update meta data to a term * * @param string $taxonomy * @param int $term_id * @param string $meta_key * @param mixed $meta_value * @param mixed $prev_value */ function largo_update_term_meta($taxonomy, $term_id, $meta_key, $meta_value, $prev_value = '') { $post_id = largo_get_term_meta_post($taxonomy, $term_id); return update_post_meta($post_id, $meta_key, $meta_value, $prev_value); }
$rss_link = get_category_feed_link(get_queried_object_id()); $posts_term = of_get_option('posts_term_plural', 'Stories'); $queried_object = get_queried_object(); ?> <div class="clearfix"> <header class="archive-background clearfix"> <a class="rss-link rss-subscribe-link" href="<?php echo $rss_link; ?> "><?php echo __('Subscribe', 'largo'); ?> <i class="icon-rss"></i></a> <?php $post_id = largo_get_term_meta_post($queried_object->taxonomy, $queried_object->term_id); largo_hero($post_id); ?> <h1 class="page-title"><?php echo $title; ?> </h1> <div class="archive-description"><?php echo $description; ?> </div> <?php get_template_part('partials/archive', 'category-related'); ?> </header>
/** * Enqueue the featured media javascript * * @global $post * @global LARGO_DEBUG * @param array $hook The page that this function is being run on. */ function largo_enqueue_featured_media_js($hook) { if (!in_array($hook, array('edit.php', 'edit-tags.php', 'post-new.php', 'post.php'))) { return; } global $post, $wp_query; if (in_array($hook, array('edit-tags.php')) && isset($_GET['action'])) { $post = get_post(largo_get_term_meta_post($_GET['taxonomy'], $_GET['tag_ID'])); } $featured_image_display = get_post_meta($post->ID, 'featured-image-display', true); $suffix = LARGO_DEBUG ? '' : '.min'; wp_enqueue_script('largo_featured_media', get_template_directory_uri() . '/js/featured-media' . $suffix . '.js', array('media-models', 'media-views'), false, 1); wp_enqueue_style('largo_featured_media', get_template_directory_uri() . '/css/featured-media' . $suffix . '.css'); wp_localize_script('largo_featured_media', 'LFM', array('options' => largo_default_featured_media_types(), 'featured_image_display' => !empty($featured_image_display), 'has_featured_media' => (bool) largo_has_featured_media($post->ID))); }