/** * Adds custom nav menu item classes. * * @since 0.1.0 * @access public * @param array $classes * @param object $item * @param object $args */ function socially_awkward_nav_menu_css_class($classes, $item, $args) { if ('formats' === $args->theme_location && 'taxonomy' === $item->type && 'post_format' === $item->object) { $classes[] = 'menu-item-' . hybrid_clean_post_format_slug(get_term_field('slug', $item->object_id, $item->object, 'attribute')); } if ('post_type' === $item->type && 'page' === $item->object && $item->object_id == get_option('page_for_posts')) { $classes[] = 'menu-item-blog'; } return $classes; }
/** * Gets the plural version of a post format name. * * @since 1.6.0 * @access public * @param string $slug The term slug. * @return string */ function hybrid_get_plural_post_format_string($slug) { $strings = hybrid_get_plural_post_format_strings(); $slug = hybrid_clean_post_format_slug($slug); return isset($strings[$slug]) ? $strings[$slug] : ''; }
/** * Overrides WP's default template for category- and tag-based archives. This allows better * organization of taxonomy template files by making categories and post tags work the same way as * other taxonomies. The hierarchy is taxonomy-$taxonomy-$term.php, taxonomy-$taxonomy.php, * taxonomy.php, archive.php. * * @since 0.7.0 * @access public * @param string $template * @return string Full path to file. */ function hybrid_taxonomy_template($template) { // Get the queried term object. $term = get_queried_object(); // Remove 'post-format' from the slug. $slug = 'post_format' === $term->taxonomy ? hybrid_clean_post_format_slug($term->slug) : $term->slug; // Return the available templates. return locate_template(array("taxonomy-{$term->taxonomy}-{$slug}.php", "taxonomy-{$term->taxonomy}.php", 'taxonomy.php', 'archive.php')); }