Breadcrumb Trail - Version 0.3

Version Description

Download this release

Release Info

Developer greenshady
Plugin Icon 128x128 Breadcrumb Trail
Version 0.3
Comparing to
See all releases

Code changes from version 0.2 to 0.3

en_EN.mo → breadcrumb-trail-en_EN.mo RENAMED
File without changes
en_EN.po → breadcrumb-trail-en_EN.po RENAMED
File without changes
breadcrumb-trail.php CHANGED
@@ -3,17 +3,16 @@
3
  * Plugin Name: Breadcrumb Trail
4
  * Plugin URI: http://justintadlock.com/archives/2009/04/05/breadcrumb-trail-wordpress-plugin
5
  * Description: A WordPress plugin that gives you the <code>breadcrumb_trail()</code> template tag to use anywhere in your theme to show a breadcrumb menu.
6
- * Version: 0.2
7
  * Author: Justin Tadlock
8
  * Author URI: http://justintadlock.com
9
  *
10
- * A script for showing a breadcrumb menu within template files.
11
- * Use the template tag breadcrumb_trail() to get it to display.
12
- * Two filter hooks are available for developers to change the
13
- * output: breadcrumb_trail_args and breadcrumb_trail.
14
  *
15
- * @copyright 2008 - 2009
16
- * @version 0.2
17
  * @author Justin Tadlock
18
  * @link http://justintadlock.com/archives/2009/04/05/breadcrumb-trail-wordpress-plugin
19
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
@@ -36,20 +35,22 @@
36
  load_plugin_textdomain( 'breadcrumb-trail', false, 'breadcrumb-trail' );
37
 
38
  /**
39
- * Shows a breadcrumb for all types of pages. Themes and
40
- * plugins can filter $args or input directly. Allow filtering of
41
- * only the $args using get_the_breadcrumb_args.
42
  *
43
  * @since 0.1
44
  * @param array $args Mixed arguments for the menu.
45
  * @return string Output of the breadcrumb menu.
46
  */
47
  function breadcrumb_trail( $args = array() ) {
48
- global $wp_query;
49
 
50
  /* Get the textdomain. */
51
  $textdomain = 'breadcrumb-trail';
52
 
 
 
 
53
  /* Set up the default arguments for the breadcrumb. */
54
  $defaults = array(
55
  'separator' => '/',
@@ -57,89 +58,138 @@ function breadcrumb_trail( $args = array() ) {
57
  'after' => false,
58
  'front_page' => true,
59
  'show_home' => __( 'Home', $textdomain ),
60
- 'single_tax' => 'category',
61
- 'format' => 'flat', // Implement later
62
  'echo' => true
63
  );
64
 
 
 
 
 
65
  /* Apply filters to the arguments. */
66
  $args = apply_filters( 'breadcrumb_trail_args', $args );
67
 
68
  /* Parse the arguments and extract them for easy variable naming. */
69
  extract( wp_parse_args( $args, $defaults ) );
70
 
 
 
 
 
 
71
  if ( $separator )
72
  $separator = '<span class="sep">' . $separator . '</span>';
73
 
74
- if ( is_front_page() && !$front_page )
75
- return apply_filters( 'breadcrumb_trail', false );
 
76
 
77
- if ( $show_home && is_front_page() )
78
- $trail['trail_end'] = "{$show_home}";
79
- elseif ( $show_home )
80
- $trail[] = '<a href="' . get_bloginfo( 'url' ) . '" title="' . get_bloginfo( 'name' ) . '" rel="home" class="trail-begin">' . $show_home . '</a>';
 
 
 
81
 
82
- if ( is_home() && !is_front_page() ) {
 
83
  $home_page = get_page( $wp_query->get_queried_object_id() );
84
-
85
- $parent_id = $home_page->post_parent;
86
- while ( $parent_id ) {
87
- $page = get_page( $parent_id );
88
- $parents[] = '<a href="' . get_permalink( $page->ID ) . '" title="' . get_the_title( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>';
89
- $parent_id = $page->post_parent;
90
- }
91
- if ( $parents ) {
92
- $parents = array_reverse( $parents );
93
- foreach ( $parents as $parent )
94
- $trail[] = $parent;
95
- }
96
  $trail['trail_end'] = get_the_title( $home_page->ID );
97
  }
98
 
 
99
  elseif ( is_singular() ) {
100
 
101
- if ( is_page() ) {
102
- $parent_id = $wp_query->post->post_parent;
103
- while ( $parent_id ) {
104
- $page = get_page( $parent_id );
105
- $parents[] = '<a href="' . get_permalink( $page->ID ) . '" title="' . get_the_title( $page->ID ) . '">' . get_the_title( $page->ID ) . '</a>';
106
- $parent_id = $page->post_parent;
107
- }
108
- if ( $parents ) {
109
- $parents = array_reverse( $parents );
110
- foreach ( $parents as $parent )
111
- $trail[] = $parent;
112
- }
113
- }
114
- elseif ( is_attachment() ) {
115
- $trail[] = '<a href="' . get_permalink( $wp_query->post->post_parent ) . '" title="' . get_the_title( $wp_query->post->post_parent ) . '">' . get_the_title( $wp_query->post->post_parent ) . '</a>';
116
- }
 
117
 
118
- elseif ( is_single() ) {
119
- if ( $single_tax && $terms = get_the_term_list( $wp_query->post->ID, $single_tax, '', ', ', '' ) )
120
- $trail[] = $terms;
121
  }
122
 
 
 
 
 
 
 
 
 
 
123
  $trail['trail_end'] = get_the_title();
124
  }
125
 
 
126
  elseif ( is_archive() ) {
127
 
 
128
  if ( is_tax() || is_category() || is_tag() ) {
129
- $term = $wp_query->get_queried_object();
130
 
131
- if ( is_category() && $term->parent ) {
132
- $parents = get_category_parents( $term->parent, true, $separator, false );
133
- if ( $parents )
134
- $trail[] = $parents;
 
 
 
 
 
 
 
 
 
135
  }
136
 
 
 
 
 
 
 
 
 
 
137
  $trail['trail_end'] = $term->name;
138
  }
139
 
140
- elseif ( is_author() )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
141
  $trail['trail_end'] = get_the_author_meta( 'display_name', get_query_var( 'author' ) );
 
142
 
 
143
  elseif ( is_time() ) {
144
 
145
  if ( get_query_var( 'minute' ) && get_query_var( 'hour' ) )
@@ -152,21 +202,26 @@ function breadcrumb_trail( $args = array() ) {
152
  $trail['trail_end'] = get_the_time( __( 'g a', $textdomain ) );
153
  }
154
 
 
155
  elseif ( is_date() ) {
156
 
 
 
 
 
157
  if ( is_day() ) {
158
- $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>' . $separator;
159
- $trail[] = '<a href="' . get_month_link( get_the_time( __( 'Y', $textdomain ) ), get_the_time( __( 'm', $textdomain ) ) ) . '" title="' . get_the_time( __( 'F', $textdomain ) ) . '">' . get_the_time( __( 'F', $textdomain ) ) . '</a>' . $separator;
160
  $trail['trail_end'] = get_the_time( __( 'j', $textdomain ) );
161
  }
162
 
163
  elseif ( get_query_var( 'w' ) ) {
164
- $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>' . $separator;
165
  $trail['trail_end'] = sprintf( __( 'Week %1$s', 'hybrid' ), get_the_time( __( 'W', $textdomain ) ) );
166
  }
167
 
168
  elseif ( is_month() ) {
169
- $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>' . $separator;
170
  $trail['trail_end'] = get_the_time( __( 'F', $textdomain ) );
171
  }
172
 
@@ -176,18 +231,22 @@ function breadcrumb_trail( $args = array() ) {
176
  }
177
  }
178
 
 
179
  elseif ( is_search() )
180
  $trail['trail_end'] = sprintf( __( 'Search results for &quot;%1$s&quot;', $textdomain ), esc_attr( get_search_query() ) );
181
 
 
182
  elseif ( is_404() )
183
  $trail['trail_end'] = __( '404 Not Found', $textdomain );
184
 
185
- /* Connect the breadcrumb trail. */
186
- $breadcrumb = '<div class="breadcrumb breadcrumbs"><div class="breadcrumb-trail">';
187
- $breadcrumb .= " {$before} ";
188
- if ( is_array( $trail ) )
189
  $breadcrumb .= join( " {$separator} ", $trail );
190
- $breadcrumb .= '</div></div>';
 
 
191
 
192
  $breadcrumb = apply_filters( 'breadcrumb_trail', $breadcrumb );
193
 
@@ -198,4 +257,87 @@ function breadcrumb_trail( $args = array() ) {
198
  return $breadcrumb;
199
  }
200
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
201
  ?>
3
  * Plugin Name: Breadcrumb Trail
4
  * Plugin URI: http://justintadlock.com/archives/2009/04/05/breadcrumb-trail-wordpress-plugin
5
  * Description: A WordPress plugin that gives you the <code>breadcrumb_trail()</code> template tag to use anywhere in your theme to show a breadcrumb menu.
6
+ * Version: 0.3
7
  * Author: Justin Tadlock
8
  * Author URI: http://justintadlock.com
9
  *
10
+ * A script for showing a breadcrumb menu within template files. Use the template tag
11
+ * breadcrumb_trail() to get it to display. Two filter hooks are available for developers to
12
+ * change the output: breadcrumb_trail_args and breadcrumb_trail.
 
13
  *
14
+ * @copyright 2008 - 2010
15
+ * @version 0.3
16
  * @author Justin Tadlock
17
  * @link http://justintadlock.com/archives/2009/04/05/breadcrumb-trail-wordpress-plugin
18
  * @license http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
35
  load_plugin_textdomain( 'breadcrumb-trail', false, 'breadcrumb-trail' );
36
 
37
  /**
38
+ * Shows a breadcrumb for all types of pages. Themes and plugins can filter $args or
39
+ * input directly. Allow filtering of only the $args using get_the_breadcrumb_args.
 
40
  *
41
  * @since 0.1
42
  * @param array $args Mixed arguments for the menu.
43
  * @return string Output of the breadcrumb menu.
44
  */
45
  function breadcrumb_trail( $args = array() ) {
46
+ global $wp_query, $wp_rewrite;
47
 
48
  /* Get the textdomain. */
49
  $textdomain = 'breadcrumb-trail';
50
 
51
+ /* Create an empty array for the trail. */
52
+ $trail = array();
53
+
54
  /* Set up the default arguments for the breadcrumb. */
55
  $defaults = array(
56
  'separator' => '/',
58
  'after' => false,
59
  'front_page' => true,
60
  'show_home' => __( 'Home', $textdomain ),
61
+ 'single_tax' => false, // @deprecated 0.3 Use singular_{$post_type}_taxonomy.
 
62
  'echo' => true
63
  );
64
 
65
+ /* Allow singular post views to have a taxonomy's terms prefixing the trail. */
66
+ if ( is_singular() )
67
+ $defaults["singular_{$wp_query->post->post_type}_taxonomy"] = false;
68
+
69
  /* Apply filters to the arguments. */
70
  $args = apply_filters( 'breadcrumb_trail_args', $args );
71
 
72
  /* Parse the arguments and extract them for easy variable naming. */
73
  extract( wp_parse_args( $args, $defaults ) );
74
 
75
+ /* For backwards compatibility, set $single_tax if it's explicitly given. */
76
+ if ( $single_tax )
77
+ $args['singular_post_taxonomy'] = $single_tax;
78
+
79
+ /* Format the separator. */
80
  if ( $separator )
81
  $separator = '<span class="sep">' . $separator . '</span>';
82
 
83
+ /* If $show_home is set and we're not on the front page of the site, link to the home page. */
84
+ if ( !is_front_page() && $show_home )
85
+ $trail[] = '<a href="' . home_url() . '" title="' . get_bloginfo( 'name' ) . '" rel="home" class="trail-begin">' . $show_home . '</a>';
86
 
87
+ /* If viewing the front page of the site. */
88
+ if ( is_front_page() ) {
89
+ if ( !$front_page )
90
+ $trail = false;
91
+ elseif ( $show_home )
92
+ $trail['trail_end'] = "{$show_home}";
93
+ }
94
 
95
+ /* If viewing the "home"/posts page. */
96
+ elseif ( is_home() ) {
97
  $home_page = get_page( $wp_query->get_queried_object_id() );
98
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( $home_page->post_parent, '' ) );
 
 
 
 
 
 
 
 
 
 
 
99
  $trail['trail_end'] = get_the_title( $home_page->ID );
100
  }
101
 
102
+ /* If viewing a singular post (page, attachment, etc.). */
103
  elseif ( is_singular() ) {
104
 
105
+ /* Get singular post variables needed. */
106
+ $post_id = absint( $wp_query->post->ID );
107
+ $post_type = $wp_query->post->post_type;
108
+ $parent = $wp_query->post->post_parent;
109
+
110
+ /* If a custom post type, check if there are any pages in its hierarchy based on the slug. */
111
+ if ( 'page' !== $post_type ) {
112
+
113
+ $post_type_object = get_post_type_object( $post_type );
114
+
115
+ /* If $front has been set, add it to the $path. */
116
+ if ( 'post' == $post_type || 'attachment' == $post_type || ( $post_type_object->rewrite['with_front'] && $wp_rewrite->front ) )
117
+ $path = trailingslashit( $wp_rewrite->front );
118
+
119
+ /* If there's a slug, add it to the $path. */
120
+ if ( !empty( $post_type_object->rewrite['slug'] ) )
121
+ $path .= $post_type_object->rewrite['slug'];
122
 
123
+ /* If there's a path, check for parents. */
124
+ if ( !empty( $path ) )
125
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $path ) );
126
  }
127
 
128
+ /* If the post type is hierarchical or is an attachment, get its parents. */
129
+ if ( is_post_type_hierarchical( $post_type ) || is_attachment() )
130
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( $parent, '' ) );
131
+
132
+ /* Display terms for specific post type taxonomy if requested. */
133
+ if ( $args["singular_{$post_type}_taxonomy"] && $terms = get_the_term_list( $post_id, $args["singular_{$post_type}_taxonomy"], '', ', ', '' ) )
134
+ $trail[] = $terms;
135
+
136
+ /* End with the post title. */
137
  $trail['trail_end'] = get_the_title();
138
  }
139
 
140
+ /* If we're viewing any type of archive. */
141
  elseif ( is_archive() ) {
142
 
143
+ /* If viewing a taxonomy term archive. */
144
  if ( is_tax() || is_category() || is_tag() ) {
 
145
 
146
+ /* Get some taxonomy and term variables. */
147
+ $term = $wp_query->get_queried_object();
148
+ $taxonomy = get_taxonomy( $term->taxonomy );
149
+
150
+ /* Get the path to the term archive. Use this to determine if a page is present with it. */
151
+ if ( is_category() )
152
+ $path = get_option( 'category_base' );
153
+ elseif ( is_tag() )
154
+ $path = get_option( 'tag_base' );
155
+ else {
156
+ if ( $taxonomy->rewrite['with_front'] && $wp_rewrite->front )
157
+ $path = trailingslashit( $wp_rewrite->front );
158
+ $path .= $taxonomy->rewrite['slug'];
159
  }
160
 
161
+ /* Get parent pages by path if they exist. */
162
+ if ( $path )
163
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $path ) );
164
+
165
+ /* If the taxonomy is hierarchical, list its parent terms. */
166
+ if ( is_taxonomy_hierarchical( $term->taxonomy ) && $term->parent )
167
+ $trail = array_merge( $trail, breadcrumb_trail_get_term_parents( $term->parent, $term->taxonomy ) );
168
+
169
+ /* Add the term name to the trail end. */
170
  $trail['trail_end'] = $term->name;
171
  }
172
 
173
+ /* If viewing an author archive. */
174
+ elseif ( is_author() ) {
175
+
176
+ /* If $front has been set, add it to $path. */
177
+ if ( !empty( $wp_rewrite->front ) )
178
+ $path .= trailingslashit( $wp_rewrite->front );
179
+
180
+ /* If an $author_base exists, add it to $path. */
181
+ if ( !empty( $wp_rewrite->author_base ) )
182
+ $path .= $wp_rewrite->author_base;
183
+
184
+ /* If $path exists, check for parent pages. */
185
+ if ( !empty( $path ) )
186
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $path ) );
187
+
188
+ /* Add the author's display name to the trail end. */
189
  $trail['trail_end'] = get_the_author_meta( 'display_name', get_query_var( 'author' ) );
190
+ }
191
 
192
+ /* If viewing a time-based archive. */
193
  elseif ( is_time() ) {
194
 
195
  if ( get_query_var( 'minute' ) && get_query_var( 'hour' ) )
202
  $trail['trail_end'] = get_the_time( __( 'g a', $textdomain ) );
203
  }
204
 
205
+ /* If viewing a date-based archive. */
206
  elseif ( is_date() ) {
207
 
208
+ /* If $front has been set, check for parent pages. */
209
+ if ( $wp_rewrite->front )
210
+ $trail = array_merge( $trail, breadcrumb_trail_get_parents( '', $wp_rewrite->front ) );
211
+
212
  if ( is_day() ) {
213
+ $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>';
214
+ $trail[] = '<a href="' . get_month_link( get_the_time( __( 'Y', $textdomain ) ), get_the_time( __( 'm', $textdomain ) ) ) . '" title="' . get_the_time( __( 'F', $textdomain ) ) . '">' . get_the_time( __( 'F', $textdomain ) ) . '</a>';
215
  $trail['trail_end'] = get_the_time( __( 'j', $textdomain ) );
216
  }
217
 
218
  elseif ( get_query_var( 'w' ) ) {
219
+ $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>';
220
  $trail['trail_end'] = sprintf( __( 'Week %1$s', 'hybrid' ), get_the_time( __( 'W', $textdomain ) ) );
221
  }
222
 
223
  elseif ( is_month() ) {
224
+ $trail[] = '<a href="' . get_year_link( get_the_time( __( 'Y', $textdomain ) ) ) . '" title="' . get_the_time( __( 'Y', $textdomain ) ) . '">' . get_the_time( __( 'Y', $textdomain ) ) . '</a>';
225
  $trail['trail_end'] = get_the_time( __( 'F', $textdomain ) );
226
  }
227
 
231
  }
232
  }
233
 
234
+ /* If viewing search results. */
235
  elseif ( is_search() )
236
  $trail['trail_end'] = sprintf( __( 'Search results for &quot;%1$s&quot;', $textdomain ), esc_attr( get_search_query() ) );
237
 
238
+ /* If viewing a 404 error page. */
239
  elseif ( is_404() )
240
  $trail['trail_end'] = __( '404 Not Found', $textdomain );
241
 
242
+ /* Connect the breadcrumb trail if there are items in the trail. */
243
+ if ( is_array( $trail ) ) {
244
+ $breadcrumb = '<div class="breadcrumb breadcrumbs"><div class="breadcrumb-trail">';
245
+ $breadcrumb .= " {$before} ";
246
  $breadcrumb .= join( " {$separator} ", $trail );
247
+ $breadcrumb .= " {$after} ";
248
+ $breadcrumb .= '</div></div>';
249
+ }
250
 
251
  $breadcrumb = apply_filters( 'breadcrumb_trail', $breadcrumb );
252
 
257
  return $breadcrumb;
258
  }
259
 
260
+ /**
261
+ * Gets parent pages of any post type or taxonomy by the ID or Path. The goal of this
262
+ * function is to create a clear path back to home given what would normally be a "ghost"
263
+ * directory. If any page matches the given path, it'll be added. But, it's also just a way
264
+ * to check for a hierarchy with hierarchical post types.
265
+ *
266
+ * @since 0.3
267
+ * @param int $post_id ID of the post whose parents we want.
268
+ * @param string $path Path of a potential parent page.
269
+ * @return array $trail Array of parent page links.
270
+ */
271
+ function breadcrumb_trail_get_parents( $post_id = '', $path = '' ) {
272
+
273
+ $trail = array();
274
+
275
+ if ( empty( $post_id ) && empty( $path ) )
276
+ return $trail;
277
+
278
+ if ( empty( $post_id ) ) {
279
+ $parent_page = get_page_by_path( $path );
280
+ $post_id = $parent_page->ID;
281
+ }
282
+
283
+ if ( $post_id == 0 ) {
284
+ $path = trim( $path, '/' );
285
+ preg_match_all( "/\/.*?\z/", $path, $matches );
286
+
287
+ if ( isset( $matches ) ) {
288
+ $matches = array_reverse( $matches );
289
+
290
+ foreach ( $matches as $match ) {
291
+
292
+ $path = str_replace( $match[0], '', $path );
293
+ $parent_page = get_page_by_path( trim( $path, '/' ) );
294
+
295
+ if ( $parent_page->ID > 0 ) {
296
+ $post_id = $parent_page->ID;
297
+ break;
298
+ }
299
+ }
300
+ }
301
+ }
302
+
303
+ while ( $post_id ) {
304
+ $page = get_page( $post_id );
305
+ $parents[] = '<a href="' . get_permalink( $post_id ) . '" title="' . esc_attr( get_the_title( $post_id ) ) . '">' . get_the_title( $post_id ) . '</a>';
306
+ $post_id = $page->post_parent;
307
+ }
308
+
309
+ if ( $parents )
310
+ $trail = array_reverse( $parents );
311
+
312
+ return $trail;
313
+ }
314
+
315
+ /**
316
+ * Searches for term parents of hierarchical taxonomies. This function is similar to
317
+ * the WordPress function get_category_parents() but handles any type of taxonomy.
318
+ *
319
+ * @since 0.3
320
+ * @param int $parent_id The ID of the first parent.
321
+ * @param object|string $taxonomy The taxonomy of the term whose parents we want.
322
+ * @return array $trail Array of links to parent terms.
323
+ */
324
+ function breadcrumb_trail_get_term_parents( $parent_id = '', $taxonomy = '' ) {
325
+ $trail = array();
326
+ $parents = array();
327
+
328
+ if ( empty( $parent_id ) || empty( $taxonomy ) )
329
+ return $trail;
330
+
331
+ while ( $parent_id ) {
332
+ $parent = get_term( $parent_id, $taxonomy );
333
+ $parents[] = '<a href="' . get_term_link( $parent, $taxonomy ) . '" title="' . esc_attr( $parent->name ) . '">' . $parent->name . '</a>';
334
+ $parent_id = $parent->parent;
335
+ }
336
+
337
+ if ( $parents )
338
+ $trail = array_reverse( $parents );
339
+
340
+ return $trail;
341
+ }
342
+
343
  ?>
readme.html CHANGED
@@ -13,7 +13,7 @@
13
 
14
  <p class="first"><em>Breadcrumb Trail</em> is a plugin that displays a breadcrumb menu on your site. Plain and simple.</p>
15
 
16
- <p class="second">How is it any better than any other breadcrumb plugin? Well, it's probably not, to be perfectly honest. This is just a script I've been building upon for nearly a couple of years that I usually include with my WordPress themes. I figured I'd package it as a plugin for others to use as well.</p>
17
 
18
  <h2>How to install the plugin</h2>
19
 
@@ -42,6 +42,7 @@
42
  'after' => false,
43
  'front_page' => true,
44
  'show_home' => __('Home', 'breadcrumb_trail'),
 
45
  'echo' => true,
46
  );</code></pre>
47
 
@@ -54,6 +55,8 @@
54
  <dd>What should be shown after the trail.</dd>
55
  <dt>show_home</dt>
56
  <dd>The text for the home link. Set to <code>false</code> if no home link is needed.</dd>
 
 
57
  <dt>echo</dt>
58
  <dd>Whether to print on the screen or return for use in a function.</dd>
59
  </dl>
@@ -72,6 +75,10 @@
72
 
73
  <pre><code>&lt;?php breadcrumb_trail( array( 'before' => '{', 'after' => '}' ) ); ?></code></pre>
74
 
 
 
 
 
75
  <p>Pretty simple stuff, right? Just mix and match the parameters however you want.</p>
76
 
77
  <h2>Protect yourself from errors in the future</h2>
13
 
14
  <p class="first"><em>Breadcrumb Trail</em> is a plugin that displays a breadcrumb menu on your site. Plain and simple.</p>
15
 
16
+ <p class="second">How is it any better than any other breadcrumb plugin? Well, it's probably not, to be perfectly honest. This is just a script I've been building upon for several years that I usually include with my WordPress themes. I figured I'd package it as a plugin for others to use as well.</p>
17
 
18
  <h2>How to install the plugin</h2>
19
 
42
  'after' => false,
43
  'front_page' => true,
44
  'show_home' => __('Home', 'breadcrumb_trail'),
45
+ 'singular_{$post_type}_taxonomy' => false,
46
  'echo' => true,
47
  );</code></pre>
48
 
55
  <dd>What should be shown after the trail.</dd>
56
  <dt>show_home</dt>
57
  <dd>The text for the home link. Set to <code>false</code> if no home link is needed.</dd>
58
+ <dt>singular_{$post_type}_taxonomy</dt>
59
+ <dd>A taxonomy to use as part of the leading trail on singular views of specific post types.</dd>
60
  <dt>echo</dt>
61
  <dd>Whether to print on the screen or return for use in a function.</dd>
62
  </dl>
75
 
76
  <pre><code>&lt;?php breadcrumb_trail( array( 'before' => '{', 'after' => '}' ) ); ?></code></pre>
77
 
78
+ <p>Now, let's add post tags as part of the trail for singular posts.</p>
79
+
80
+ <pre><code>&lt;?php breadcrumb_trail( array( 'singular_post_taxonomy' => 'post_tag' ) ); ?></code></pre>
81
+
82
  <p>Pretty simple stuff, right? Just mix and match the parameters however you want.</p>
83
 
84
  <h2>Protect yourself from errors in the future</h2>
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
  === Breadcrumb Trail ===
2
  Contributors: greenshady
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3687060
4
- Tags: navigation, menu
5
- Requires at least: 2.8
6
- Tested up to: 2.9
7
- Stable tag: 0.2
8
 
9
  An easy-to-use template tag for showing a breadcrumb menu on your site.
10
 
@@ -28,7 +28,7 @@ More detailed instructions are included in the plugin's `readme.html` file. It
28
 
29
  = Why was this plugin created? =
30
 
31
- I mostly develop WordPress themes. Many of my users had a real need for a functional breadcrumb menu without having to find and test a lot of other plugins. So, I've been developing this script for nearly two years for my theme users.
32
 
33
  I finally thought it was time to release it publicly so others could enjoy the benefits of this plugin just as my theme users have been.
34
 
@@ -56,6 +56,18 @@ There are no screenshots for this plugin.
56
 
57
  == Changelog ==
58
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  ** Version 0.2 **
60
 
61
  * The title of the "home" page (i.e. posts page) when not the front page is now properly recognized.
1
  === Breadcrumb Trail ===
2
  Contributors: greenshady
3
  Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=3687060
4
+ Tags: navigation, menu, breadcrumb, breadcrumbs
5
+ Requires at least: 3.0
6
+ Tested up to: 3.0
7
+ Stable tag: 0.3
8
 
9
  An easy-to-use template tag for showing a breadcrumb menu on your site.
10
 
28
 
29
  = Why was this plugin created? =
30
 
31
+ I mostly develop WordPress themes. Many of my users had a real need for a functional breadcrumb menu without having to find and test a lot of other plugins. So, I've been developing this script for several years for my theme users.
32
 
33
  I finally thought it was time to release it publicly so others could enjoy the benefits of this plugin just as my theme users have been.
34
 
56
 
57
  == Changelog ==
58
 
59
+ **Version 0.3**
60
+
61
+ * Added more support for custom post types and taxonomies.
62
+ * Added more support for more complex hierarchies.
63
+ * The breadcrumb trail now recognizes more patterns with pages as part of the permalink structure of other objects.
64
+ * All post types can have any taxonomy as the leading part of the trail.
65
+ * Cleaned up the code.
66
+
67
+ ** Version 0.2.1 **
68
+
69
+ * Removed and/or added (depending on the case) the extra separator item on sub-categories and date-/time-based breadcrumbs.
70
+
71
  ** Version 0.2 **
72
 
73
  * The title of the "home" page (i.e. posts page) when not the front page is now properly recognized.