My coworker wanted breadcrumbs where the ancestry went from h1 all the way down to as deep as you are for one of our clients’ website, and so I wrote this little function for him:
<?php function hawt_breadcrumb() { global $post; $pages = array(); $pages[] = array(get_permalink(), get_the_title()); $parent = $post->post_parent; while($parent) { $pages[] = array(get_permalink($parent), get_the_title($parent)); $parent = get_post($parent)->post_parent; } $i = 1; foreach(array_reverse($pages) as $page) { echo "<h$i>$page[1]</h$i>"; $i++; } } ?>
Might as well share it in case someone is in the need of something similar. :)
very nice!
I wonder how many WP developers can make it in just a few lines as well lol! I guess not many ;)
bookmarking this page, I have a feeling it might come handy sometime!
:)
[…] using the permalink on my blog and it shows up just fine on Facebook. That's me liking this post. I'm using the iframe code though, more precisely this here: HTML […]