WP Breadcrumbs Minor error - Coder Assistance Required

by Tim3
4 replies
Hi folks,

I have a minor problem here with my 'crumbs, I've had a bit of a fiddle about on my own, but my alterations just keep breaking the theme, (Premium Style) so am seeking some expert advice from you guys over here.

Website name and the tagline in the header are on.
Site uses pages/sub-pages not categories and posts
The breadcrumbs work fine except this one thing...

I'll just illustrate the problem to put you in the picture.

The theme shows this breadcrumbs this way on any page...

Home »» The Page TitleWebsite Name

Which of course is not good and looks horrible

(In case anyone missed it or is tired, there is no space after the page title!)

So, my ideal solution would be to get rid of the of the website name entirely after the Page title.
Failing that the second prize would be to add a space after the Page Title (or before the site name)

Question is, How?

The theme has a breadcrumbs.php file which is below.

Any ideas please?
Thanks for your time


Code:


<!-- start breadcrumbs -->
<div id="breadcrumbs">
  <?php if(function_exists('bcn_display')) { bcn_display(); } 
          else { ?>
  <a href="<?php echo home_url(); ?>">
  <?php _e('Home','gopiplustheme') ?>
  </a>
  <?php echo ('&raquo;&raquo;&nbsp;'); ?>
  <?php if( is_tag() ) { ?>
  <?php _e('Posts Tagged &quot;','gopiplustheme') ?>
  <?php single_tag_title(); echo('&quot;'); ?>
  <?php } elseif (is_day()) { ?>
  <?php _e('Posts made in','gopiplustheme') ?>
  <?php the_time('F jS, Y'); ?>
  <?php } elseif (is_month()) { ?>
  <?php _e('Posts made in','gopiplustheme') ?>
  <?php the_time('F, Y'); ?>
  <?php } elseif (is_year()) { ?>
  <?php _e('Posts made in','gopiplustheme') ?>
  <?php the_time('Y'); ?> 

  <?php } elseif (is_search()) { ?>
  <?php _e('Search results for','gopiplustheme') ?>
  <?php the_search_query() ?>
  <?php } elseif (is_single()) { ?>
  <?php $category = get_the_category();
                          if (!empty($category)) 
                          { 
                                $catlink = get_category_link( $category[0]->cat_ID );
                                echo ('<a href="'.$catlink.'">'.$category[0]->cat_name.'</a> &raquo;&raquo;&nbsp;'.get_the_title());
                          }; 
                    ?>
  <?php } elseif (is_category()) { ?>
  <?php single_cat_title(); ?>
  <?php } elseif (is_author()) { ?>
  <?php global $wp_query;
                          $curauth = $wp_query->get_queried_object(); ?>
  <?php _e('Posts by ','gopiplustheme'); echo ' ',$curauth->nickname; ?>
  <?php } elseif (is_page()) { ?>
  <?php wp_title('') ?>
  <?php }; ?>
  <?php }; ?>
</div>
#assistance #breadcrumbs #coder #error #minor #required
  • Profile picture of the author WPThemeGuru
    do you still have the problem...? I think you should look deeper this function. <?php if(function_exists('bcn_display')) { bcn_display(); }
    {{ DiscussionBoard.errors[9866421].message }}
    • Profile picture of the author Tim3
      Originally Posted by WPThemeGuru View Post

      do you still have the problem...? I think you should look deeper this function. <?php if(function_exists('bcn_display')) { bcn_display(); }
      Hi WPTG,

      I thought everyone was ignoring me - Next!

      Yes, the problem still exists and I have been unable to solve it, there is dick in the SE's about this, all the results are for folks wanting to remove them completely.

      The only thing I know for sure is that the Site Name is being pulled from the WP settings page, I tested it by adding a dot, which then appears in the crumbs, ( a space is not allowed and gets removed.)

      I will have a poke about with the bcn function now and see what happens, thanks for your advice.

      Edit:
      It seems that bcn command is for actually displaying the crumbs, removing it causes a syntax error displayed as unexpected '}' on line 53 which is near the bottom?
      I just cannot seem to find anything in any php files that is calling the site name to display in the crumbs, on the theme owners page (same theme) all is well, so perhaps I have a conflict somewhere.
      Signature

      {{ DiscussionBoard.errors[9868331].message }}
  • Profile picture of the author SteveJohnson
    This is such crappily written code it's unbelievable.

    Anyhow, change this line:
    HTML Code:
    <?php wp_title('') ?>
    to this:
    HTML Code:
    <?php echo '&nbsp;'; wp_title('') ?>
    EDIT:
    I misread what you wanted. If you're getting breadcrumbs with the site title appended to the end, the main breadcrumb function isn't working (you're getting into the 'else' part of the code). The title is displayed by the "wp_title('')" call. The code I gave you above merely puts a space in front of the title.
    Signature

    The 2nd Amendment, 1789 - The Original Homeland Security.

    Gun control means never having to say, "I missed you."

    {{ DiscussionBoard.errors[9869042].message }}
    • Profile picture of the author Tim3
      Thanks Steve,

      I am glad you have put me straight on the poor code, I wouldn't know any if it bit me in the arse.

      Funny thing is, that theme loads fast which is one reason I used it, any suggestions for a well-coded alternative that looks similar? I have no problems changing it for something else, it's not a live site.

      Code:
      <?php echo '&nbsp;'; wp_title('') ?>
      Aha, so that's where it goes, I thought that may be the answer but alas, that puts the required space in front of the page title, (to the left) so it appears like this:

      Home »» The Page TitleWebsite Name



      Thanks for your help anyway.
      Signature

      {{ DiscussionBoard.errors[9871150].message }}

Trending Topics