php - Wordpress breadcrumbs issue -
i have breadcrumb in website that's not working properly. when go product like
equipment» products» railing» heavy railing» waterproof» superrail 2000
it shows me breadcrumb should. when same product through "non-waterproof" instead of "waterproof" shows me same breadcrumb (so basicly, follows 1 category).
i wanted check in settings of breadcrumb plugin, shows me message "your settings out of date. migrate now.", , supervisor has adviced me not "migrate" it.
does have solution uses either plugin or custom code works multiple categories?
edit:
i'm working wp 3.6, i'm not allowed update. url looks http://www.website.com/product/asl6109t32/, means can't use url generate breadcrumb.
if may, here nifty code snippet creating breadcrumb navigation, place in theme'sfunctions.php
file:
/*********************************************************** * wsf_breadcrumbs() - shows breadcrumbs in template ***********************************************************/ function wsf_breadcrumbs( $sep = '/', $label = 'browsing' ) { global $post, $front_page; // not show breadcrumbs on home or front pages. // return if((is_home() || is_front_page()) && (!$front_page)) return; // create constant separator, space padding. $sep = ' ' . $sep . ' '; echo '<div class="breadcrumbs">'; echo $label; echo wsf_make_link( home_url(), 'home', get_bloginfo('name'), true ) . $sep; if(is_single()) { the_category(', '); echo $sep; } elseif (is_search()) { echo 'search results - '; } elseif (is_404()) { //wordpress bug echo 'error 404 (page not found) '; } elseif (is_author()) { echo 'articles posted author '; } elseif (is_tag()) { echo 'posts tagged '; } elseif (is_year()) { echo get_the_time('y'); } elseif (is_month()) { echo get_the_time('f').' ('.get_the_time('y').')'; } elseif (strstr($_server['request_uri'],"wp-login.php")) { echo 'administration panel'; } elseif(is_page()) { $parent_id = $post->post_parent; $parents = array(); while($parent_id) { $page = get_page($parent_id); $parents[] = wsf_make_link( get_permalink($page->id), get_the_title($page->id) ) . $sep; $parent_id = $page->post_parent; } $parents = array_reverse($parents); foreach($parents $parent) { echo $parent; } } // wordpess function echoes post title. the_title(); echo '</div>'; } /*------------------------------------------------------*/ /* create breadcrumb navigation /*------------------------------------------------------*/ /*********************************************************** * helper functions template coding ***********************************************************/ function wsf_make_link ( $url, $anchortext, $title=null, $nofollow=false ) { if ( $title == null ) $title=$anchortext; $rel = ($nofollow == true) ? ' rel="nofollow"' : $rel = ''; $link = sprintf( '<a href="%s" title="%s" %s>%s</a>', $url, $title, $rel, $anchortext ); return $link; } /*------------------------------------------------------*/ /*------------------------------------------------------*/
then, in footer.php
file, invoke function this:
<div id="breadcrumb"> <?php wsf_breadcrumbs('','') ?> </div>
Comments
Post a Comment