Thanks,
I found this function that makes the work ;
function get_breadcrumbs()
{
global $wp_query;
if ( !is_home() ){
// Start the UL
echo '<ul class="breadcrumbs">';
// Add the Home link
echo '<li><a href="'. get_settings('home') .'">'. get_bloginfo('name') .'</a></li>';
if ( is_category() )
{
$catTitle = single_cat_title( "", false );
$cat = get_cat_ID( $catTitle );
echo "<li> » ". get_category_parents( $cat, TRUE, " » " ) ."</li>";
}
elseif ( is_archive() && !is_category() )
{
echo "<li> » Archives</li>";
}
elseif ( is_search() ) {
echo "<li> » Search Results</li>";
}
elseif ( is_404() )
{
echo "<li> » 404 Not Found</li>";
}
elseif ( is_single() )
{
$category = get_the_category();
$category_id = get_cat_ID( $category[0]->cat_name );
echo '<li> » '. get_category_parents( $category_id, TRUE, " »</li><li> " );
echo the_title('','', FALSE) ."</li>";
}
elseif ( is_page() )
{
$post = $wp_query->get_queried_object();
if ( $post->post_parent == 0 ){
echo "<li> » ".the_title('','', FALSE)."</li>";
} else {
/* Kindly borrowed and adapted from Breadcrumb Titles For Pages plugin
https://www.ads-software.com/extend/plugins/page-breadcrumbs-for-wptitle/ */
$title = the_title('','', FALSE);
$prefix = "</li><li> » ";
$seplocation = ( $prefix === substr( $title, strlen( $prefix ) * -1 ) ) ? 'right' : 'left';
$ancestors = array_reverse( $post->ancestors );
$ancestors[] = $post->ID;
$titles = array();
foreach ( $ancestors as $ancestor ){
if( $ancestor != end($ancestors) ){
$titles[] = '<a href="'. get_permalink($ancestor) .'">'. strip_tags( apply_filters( 'single_post_title', get_the_title( $ancestor ) ) ) .'</a>';
} else {
$titles[] = strip_tags( apply_filters( 'single_post_title', get_the_title( $ancestor ) ) );
}
}
$title = implode( $prefix, $titles );
if ( $seplocation == 'right' )
$title = $title . $prefix;
else
$title = $prefix . $title;
echo $title;
}
}
// End the UL
echo "</ul>";
}
}
And then you call the breadcrumbs with;
<?php get_breadcrumbs(); ?>
The function works really fine on the WordPress 2.8 version, but as on the second site I am working on, I’m limited on the version 2.5, and I am getting the following error;
Warning: array_reverse() [function.array-reverse]: The argument should be an array in /usr/share/wordpress/wp-content/themes/cim/functions.php on line 470
Line 470 sounds: $ancestors = array_reverse( $post->ancestors );
What is the problem?