Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
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...
commit fd089d35073e85d9f832597adbf4de47e52440cb 1 parent 90b3c10
Justin Tadlock authored
Showing with 14 additions and 7 deletions.
  1. +14 −7 extensions/breadcrumb-trail.php
21 extensions/breadcrumb-trail.php
View
@@ -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 ) );
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.