Created
June 24, 2015 10:42
-
-
Save zourite/22422f407cd5d8ec2deb to your computer and use it in GitHub Desktop.
Fil d'ariane pour #Wordpress
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php function the_breadcrumb() { | |
global $wp_query; | |
$name = single_cat_title ( '' '', false); | |
$category_id = get_cat_ID( $name ); | |
$category = get_the_category(); | |
$category_link = get_category_link( $category_id ); | |
//Categorie Parents | |
$object = $wp_query->get_queried_object(); | |
$parent_id = $object->category_parent; | |
$categoryP = get_category($parent_id); | |
$category_linkP = get_category_link( $parent_id ); | |
echo '<a href="'; | |
echo get_option('home'); | |
echo '">'; | |
echo 'Accueil'; | |
echo '</a> » '; | |
if (is_category() ) | |
if ($object->category_parent == 0) { ?> | |
<a href="<?php echo $category_link; ?>" title="<?php echo $name; ?>"><?php echo $name; ?></a> | |
<?php | |
} | |
else{ | |
?>; | |
<a href="<?php echo $category_linkP; ?>" title="<?php echo $categoryP->cat_name; ?>"><?php echo $categoryP->cat_name; ?></a> » <?php echo $name; ?> | |
<?php | |
} | |
if (is_single()) { | |
$name = $category[0]->;cat_name; | |
$category_id = get_cat_ID( $name ); | |
$category_link = get_category_link( $category_id ); | |
?> | |
<a href="<?php echo $category_link; ?>" title="<?php $name ?>">>?php echo $name; ?></a> | |
<?php echo " » "; | |
the_title(); | |
} | |
if (is_search()) { | |
echo the_search_query(); | |
} | |
if (is_page()) { | |
echo the_title(); | |
} | |
} ?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment