Skip to content

Instantly share code, notes, and snippets.

@Aziz-Rahman
Created February 16, 2015 02:22
Show Gist options
  • Save Aziz-Rahman/23242c2cd9424e27fb1b to your computer and use it in GitHub Desktop.
Save Aziz-Rahman/23242c2cd9424e27fb1b to your computer and use it in GitHub Desktop.
Breadcrumb pada wordpress (Tanpa Plugin)
<?php
/**
* Function to display breadcrumb
*
* @package WordPress
* @subpackage My Theme
* @since My Theme 1.0.0
*/
function the_breadcrumb() {
if (!is_home()) {
echo '<a href="';
echo get_option('home');
echo '">';
bloginfo('name');
echo "</a> &raquo; ";
if (is_category() || is_single()) {
the_category('title_li=');
if (is_single()) {
echo " &raquo; ";
the_title();
}
} elseif (is_page()) {
echo the_title();
}
}
}
//letakan kode d atas di file function.php
?>
<!-- Pemanggilan -->
<?php the_breadcrumb(); //utk pemanggilan, letakan ini di file single.php ?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment