Skip to content

Instantly share code, notes, and snippets.

@sean-gilmore
Created May 28, 2017 11:50
Show Gist options
  • Select an option

  • Save sean-gilmore/8ba057fa3ebee61f253af6ffd136d9cd to your computer and use it in GitHub Desktop.

Select an option

Save sean-gilmore/8ba057fa3ebee61f253af6ffd136d9cd to your computer and use it in GitHub Desktop.
Paste this inside the functions.php file, call on page, pass in page id
<?php
function the_breadcrumb($id) {
$result= "";
if($id == 0) {
echo '<a href="' . get_permalink(get_option( 'page_on_front' )) . '">Home</a>';
} else if (get_post_type($id) == "team") {
$parent = get_page_by_title("Meet Our Team")->ID;
$result.= the_breadcrumb($parent);
echo '<a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a>';
} else {
$result.= the_breadcrumb(wp_get_post_parent_id($id));
echo '<a href="' . get_permalink($id) . '">' . get_the_title($id) . '</a>';
}
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment