Forums

Breadcrumb Script - Template Tags - Highlighting an individual page (2 posts)

  1. rahish
    Member
    Posted 2 years ago #

    I have used a breadcrumb script from Smashing Magazine article

    http://www.smashingmagazine.com/2009/07/02/power-tips-for-wordpress-template-developers/

    and it works well for my needs however I have two selective nav bars. to show the pages from wordpress (two different parts of the site)

    My question is this. Is it possible to alter the script so that you could add a new sub root page to the trail using a condition such as something along the lines of
    If (is_page('subsection')) Subsection | ?

    the script is already allowing for the word Blog to be part of the breadcrumb trail if you select a page or category from the blog

    Here is the code as appears in header.php

    <div id="breadcrumb">
    
          <?php   
    
          if ((is_page()) || is_home() ||is_category() || is_single())
          {
       				echo '<ul id="breadcrumbs">';
       				echo '<li class="front_page"><a href="'.get_bloginfo('url').'">home</a> | </li>';
       			$post_ancestors = get_post_ancestors($post);
       			if ($post_ancestors) {
       	       $post_ancestors = array_reverse($post_ancestors);
       	       foreach ($post_ancestors as $crumb)
       	           echo '<li><a href="'.get_permalink($crumb).'">'.get_the_title($crumb).'</a></li>';
       	   }
    
      	    if (is_category() || is_single()) {
      	       $category = get_the_category();
      	       echo ' blog | <li><a href="'.get_category_link($category[0]->cat_ID).'">'.$category[0]->cat_name.'</a> | </li>';
      	   }
      	    if (!is_category())
      	       echo '<li class="current"><a href="'.get_permalink().'">'.get_the_title().'</a></li>';
      	    echo '</ul>';  
    
       }
    ?>
    
            </div>
  2. rahish
    Member
    Posted 2 years ago #

    bump

Topic Closed

This topic has been closed to new replies.

About this Topic