Permalink
Browse files

Only run the current attachment code for getting the parent trail if …

…the post type is 'post'. @todo Still need to handle attachments for custom post types.
  • Loading branch information...
1 parent 90b3c10 commit fd089d35073e85d9f832597adbf4de47e52440cb @justintadlock committed Sep 21, 2012
Showing with 14 additions and 7 deletions.
  1. +14 −7 extensions/breadcrumb-trail.php
@@ -177,15 +177,22 @@ function breadcrumb_trail_get_items( $args = array() ) {
/* If the attachment has a parent (attached to a post). */
if ( 0 < $parent_id ) {
- /* If $front has been set, add it to the $path. */
- $path .= trailingslashit( $wp_rewrite->front );
+ /* Get the parent post type. */
+ $parent_post_type = get_post_type( $parent_id );
+
+ /* If the post type is 'post'. */
+ if ( 'post' == $parent_post_type ) {
- /* If there's a path, check for parents. */
- if ( !empty( $path ) )
- $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $path ) );
+ /* If $front has been set, add it to the $path. */
+ $path .= trailingslashit( $wp_rewrite->front );
- /* Map the post (parent) permalink structure tags to actual links. */
- $trail = array_merge( $trail, breadcrumb_trail_map_rewrite_tags( $post->post_parent, get_option( 'permalink_structure' ), $args ) );
+ /* If there's a path, check for parents. */
+ if ( !empty( $path ) )
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $path ) );
+
+ /* Map the post (parent) permalink structure tags to actual links. */
+ $trail = array_merge( $trail, breadcrumb_trail_map_rewrite_tags( $post->post_parent, get_option( 'permalink_structure' ), $args ) );
+ }
}
}

0 comments on commit fd089d3

Please sign in to comment.