Browse files

Remove 'post-format-' from taxonomy template names and the <body> class.

git-svn-id: http://svn.locallylost.com/themes/hybrid-core/trunk@946 dba0f204-706d-4bc1-bc29-8b92e0485636
  • Loading branch information...
1 parent ac408db commit d749fca373058982fc603fb7f2906305f96589ce greenshady committed Dec 9, 2011
Showing with 8 additions and 2 deletions.
  1. +3 −1 functions/context.php
  2. +5 −1 functions/template-hierarchy.php
View
4 functions/context.php
@@ -65,7 +65,9 @@ function hybrid_get_context() {
if ( is_tax() || is_category() || is_tag() ) {
$hybrid->context[] = 'taxonomy';
$hybrid->context[] = "taxonomy-{$object->taxonomy}";
- $hybrid->context[] = "taxonomy-{$object->taxonomy}-" . sanitize_html_class( $object->slug, $object->term_id );
+
+ $slug = ( ( 'post_format' == $object->taxonomy ) ? str_replace( 'post-format-', '', $object->slug ) : $object->slug );
+ $hybrid->context[] = "taxonomy-{$object->taxonomy}-" . sanitize_html_class( $slug, $object->term_id );
}
/* Post type archives. */
View
6 functions/template-hierarchy.php
@@ -22,6 +22,7 @@
/* Filter the tag and category (taxonomy) templates. */
add_filter( 'tag_template', 'hybrid_taxonomy_template' );
add_filter( 'category_template', 'hybrid_taxonomy_template' );
+add_filter( 'taxonomy_template', 'hybrid_taxonomy_template' );
/* Filter the single, page, and attachment (singular) templates. */
add_filter( 'single_template', 'hybrid_singular_template' );
@@ -141,8 +142,11 @@ 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 ) ? str_replace( 'post-format-', '', $term->slug ) : $term->slug );
+
/* Return the available templates. */
- return locate_template( array( "taxonomy-{$term->taxonomy}-{$term->slug}.php", "taxonomy-{$term->taxonomy}.php", 'taxonomy.php', 'archive.php' ) );
+ return locate_template( array( "taxonomy-{$term->taxonomy}-{$slug}.php", "taxonomy-{$term->taxonomy}.php", 'taxonomy.php', 'archive.php' ) );
}
/**

0 comments on commit d749fca

Please sign in to comment.