Support » Fixing WordPress » breadcrumbs function not working.

  • Resolved pdxDaniela


    Found this function online

    function the_breadcrumb() {
            echo '<ul id="breadcrumbs">';
        if (!is_home()) {
            echo '<li><a href="';
            echo get_option('home');
            echo '">';
            echo 'Home';
            echo "</a></li>";
            if (is_category() || is_single()) {
                echo '<li>';
                the_category(' </li><li> ');
                if (is_single()) {
                    echo "</li><li>";
                    echo '</li>';
            } elseif (is_page()) {
                echo '<li>';
                echo the_title();
                echo '</li>';
        elseif (is_tag()) {single_tag_title();}
        elseif (is_day()) {echo"<li>Archive for "; the_time('F jS, Y'); echo'</li>';}
        elseif (is_month()) {echo"<li>Archive for "; the_time('F, Y'); echo'</li>';}
        elseif (is_year()) {echo"<li>Archive for "; the_time('Y'); echo'</li>';}
        elseif (is_author()) {echo"<li>Author Archive"; echo'</li>';}
        elseif (isset($_GET['paged']) && !empty($_GET['paged'])) {echo "<li>Blog Archives"; echo'</li>';}
        elseif (is_search()) {echo"<li>Search Results"; echo'</li>';}
        echo '</ul>';

    and then i call it w/
    <?php the_breadcrumb(); ?>

    but I get this

    Parse error: syntax error, unexpected ”<ul id=” (T_CONSTANT_ENCAPSED_STRING) in C:\xampp\htdocs\wordpress\wp-content\themes\cdiDlm03\functions.php on line 163

    how do i go about fixing this?
    Thank you

Viewing 6 replies - 1 through 6 (of 6 total)
  • What is the actual line that is throwing the error? I’m guessing it’s echo ‘<ul id=”breadcrumbs”>’; but just want to be sure.

    Hey grphical. Actually I belive that is it.
    so while i’d be curious to find out a found a better function (seems to work so far) at

    I just tested the code on a fresh install of wp 3.6 and I have no issue with the code. My suspicion is that something else in your functions.php file might be effecting it but the code itself seems to be fine.

    not sure then but the new function i posted the link to is working fine.
    only thing, it creates three links. the top one remains empty. As i put the get_breadcrumbs call only on the third level pages. so not sure how to populate the top link?
    any advice please?

    that is of course the home link. how can i put an image (mini logo mabye) there instead?

    echo '<li><a href="'. get_settings('home') .'">'. get_bloginfo('name') .'</a></li>';
    or if I delete this will it wipe out the entire function?

    just answered my own question. Deleted
    echo '<li><a href="'. get_settings('home') .'">'. get_bloginfo('name') .'</a></li>';

    worked (hope it won’t break anything later on)

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘breadcrumbs function not working.’ is closed to new replies.