• Hi,
    I created a breadcrumb hack for the index.php. You can see it in action @ my blog. It works with WP 1.01.

    function get_breadcrumb($showRoot = true, $rootName = "Home") {
    global $p, $m, $author, $blogfilename, $s, $cat, $siteurl, $blogfilename, $tablecategories;
    echo "<div id=\"breadcrumb\">";
    if ($p || $m || $author || $s || $cat) {
    echo "$rootName > ";
    if ($p) {
    echo ""; the_title(); echo "";
    } else if ($m) {
    echo "Posts of ";
    if (strlen($m) == 6) {
    echo "" . date("F Y", strtotime($m."01")) . "";
    } else {
    echo "" . date("d.m.Y", strtotime($m)) . "";
    }
    } else if ($author) {
    $user = get_userdata($author);
    echo "Posts by $user->user_nickname";
    } else if ($s) {
    echo "Search Results for $s";
    } else if ($cat) {
    echo "Category " . get_the_category_by_ID($cat) . "";
    }
    } else if ($showRoot) {
    echo $rootName;
    }
    echo "</div>\n";
    }

    Post it here in the index.php:

    <div id="content">
    <?php get_breadcrumb(); ?>
    <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>

    And yes, I will post it to the wiki shortly.

Viewing 8 replies - 16 through 23 (of 23 total)
  • I was curious if what I have on my site is an example of breadcrumb …
    http://www.blindmuse.com
    If you click into archives it shows you where you’ve gone, if you click into a post specifically it shows you where you are in concerns to topics, months, etc. Granted, I don’t include links for the user to back out again, but that is a simple addition. If what I’ve done is correct, I’ll be more than happy to add it as an alternative.

    I’m working on a full breadcrumb hack now, should be done soon 🙂
    Example on my site listed above.

    Ah, but will it work outside the wp loop, chuckg?
    Call

    Indeed.
    I don’t rely on the WP loop for breadcrumbs, I wrote my own functions which use the URL to determine what’s going on. Muaha. Almost done, again.

    The above was me…I forgot to mention that what I’ve written is really dependent on whether or not you’re using permalinks, and what kind of structure you’re using as well. That’s the reason it’s taking me so long to package it as “generic”, cause right now it’s very specific to my own site and I’m hesitant to take away the functionality I enjoy. Ya know?

    A modification of the original hack:
    <?php
    function get_breadcrumb($showRoot = true, $rootName = “Home”) {
    global $p, $m, $author, $blogfilename, $s, $cat, $siteurl, $blogfilename, $tablecategories;
    echo “<div id=\”breadcrumb\”>”;
    if ($p || $m || $author || $s || $cat) {
    echo “Blog
    “;
    if ($p) {
    echo ““; the_date(‘jS F Y’); echo “
    “; the_title(); echo ““;
    } else if ($m) {
    echo “Posts of “;
    if (strlen($m) == 6) {
    echo “” . date(“F Y”, strtotime($m.”01″)) . ““;
    } else {
    echo “” . date(“d.m.Y”, strtotime($m)) . ““;
    }
    } else if ($author) {
    $user = get_userdata($author);
    echo “Posts by $user->user_nickname“;
    } else if ($s) {
    echo “<span class=\”leveltwo\”>Search: $s</span>”;
    } else if ($cat) {
    echo “<span class=\”leveltwo\”>Category: ” . get_the_category_by_ID($cat) . “</span>”;
    }
    } else if ($showRoot) {
    echo “Blog
    “;
    }
    echo “</div>\n”;
    }
    ?>
    This displays:

    Blog
    Date
    Post Name

    when you’re looking at an entry page, which I think is a bit more useful.

    Call

    Can some one tell me exactly where to paste the code for this last hack [Anonymous].
    Sorry to be such a newbie. But I could not make any sense of the instructions Lennart
    provided regarding where to past the code.
    Plus, is it just me or is the actual code he pasted nonexistent in the index.php?
    My index.php:
    <div id=”content”>
    <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    <?php the_date(”,'<h2>’,'</h2>’); ?>
    <div class=”storycontent”>
    <?php the_content(); ?></div>
    Lennarts Example:
    <div id=”content”>
    <?php get_breadcrumb(); ?>
    <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?>
    This is very confusing.
    Could someone please post the exact code and where it exactly should be pasted in what file?

    http://technicallyincorrect.org/index.php?p=108
    charle97 left this link for you before – did it not work ?

Viewing 8 replies - 16 through 23 (of 23 total)

The topic ‘Breadcrumb Hack for 1.01’ is closed to new replies.