Skip to content

Instantly share code, notes, and snippets.

@samonja
Created June 26, 2017 22:27
Show Gist options
  • Save samonja/429f84fc2feace81a2e39ed90ce07946 to your computer and use it in GitHub Desktop.
Save samonja/429f84fc2feace81a2e39ed90ce07946 to your computer and use it in GitHub Desktop.
Generate breadcrumbs
/**
* Generate breadcrumbs
* @author CodexWorld
* @authorURL www.codexworld.com
*/
function get_breadcrumb() {
echo '<a href="/blog/" rel="nofollow">Blog</a>';
if (is_category() || is_single()) {
echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
the_category(' &bull; ');
if (is_single()) {
echo " &nbsp;&nbsp;&#187;&nbsp;&nbsp; ";
the_title();
}
} elseif (is_page()) {
echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;";
echo the_title();
} elseif (is_search()) {
echo "&nbsp;&nbsp;&#187;&nbsp;&nbsp;Search Results for... ";
echo '"<em>';
echo the_search_query();
echo '</em>"';
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment