Ben WP tabanlı bir sitede klasik galeta unu görüntülemek çalışıyorum. Ben şu işlevi var,
//breadcrumb function
function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
//bloginfo('name');
echo 'Home';
echo "</a> > ";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
Sayfa bir üst kategori içinde Ama ne zaman (yani, hakkında (Veli), Advisors (Çocuk)) sadece alt sayfa gösterir. Herhangi Ben de ana sayfasını göstermek için bir koşul ekleyebilirsiniz nasıl düşünce? Herhangi bir yardım büyük mutluluk duyacağız.
/* EDITED */ I found a perfect working function for it:
function breadcrumbTrail($crumbs = true, $title = 'Browse', $separator = '/')
{
global $post;
?>
<div class="breadcrumbs">
<a href="<?php bloginfo('url'); ?>" title="<?php bloginfo('name'); ?>"><?php _e('Home','options'); ?></a> <?php echo $separator; ?>
<?php
if(is_single()) :
the_category(', '); echo ' ' . $separator . ' ';
elseif(is_page()) :
$parent_id = $post->post_parent;
$parents = array();
while($parent_id) :
$page = get_page($parent_id);
if($params["link_none"])
$parents[] = get_the_title($page->ID);
else
$parents[] = '<a href="'.get_permalink($page->ID).'" title="'.get_the_title($page->ID).'">'.get_the_title($page->ID).'</a> ' . $separator . ' ';
$parent_id = $page->post_parent;
endwhile;
$parents = array_reverse($parents);
foreach($parents as $val) :
echo $val;
endforeach;
endif;
the_title();
?>
</div>
<?php
}
Bu kimse yardımcı olur umarım.