Advertisement
samikeijonen

Filter breadcrumb_trail_items

May 17th, 2012
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. add_filter( 'breadcrumb_trail_items', 'my_breadcrumb_trail_items', 10, 2 );
  2.  
  3. function my_breadcrumb_trail_items( $items, $args ) {
  4.  
  5.     if ( is_singular( 'post' ) ) {
  6.  
  7.             $items = array_splice( $items, 0, -2 );
  8.             $items[] = '<a href="' . home_url() . '/recent-posts/" title="Recent post" rel="home" class="trail-begin">' . Posts . '</a>';
  9.             $items[] = '<a href="' . get_year_link( get_the_time( 'Y', $post_id ) ) . '" title="' . get_the_time( esc_attr__( 'Y', 'breadcrumb-trail' ), $post_id ) . '">' . get_the_time( __( 'Y', 'breadcrumb-trail' ), $post_id ) . '</a>';
  10.             $items[] = get_the_title();
  11.     }
  12.  
  13.     return $items;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement