Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Breadcrumbs for page parent creates an infinite loop #74

Closed
jazzsequence opened this issue Dec 31, 2014 · 1 comment
Closed

Breadcrumbs for page parent creates an infinite loop #74

jazzsequence opened this issue Dec 31, 2014 · 1 comment

Comments

@jazzsequence
Copy link
Owner

http://museumthemes.com/core/parent-page/child-page-1/

Reported in: https://wordpress.org/support/topic/breadcrumbs-bug

Relevant code (like 938 functions.php):

 while ( $parent_id ) {
                $page = get_post($parent_id);
                $breadcrumbs[] = '<li><span typeof="v:Breadcrumb"><a rel="v:url" property="v:title" href="' . get_permalink($page->ID) . '">' . get_the_title( $page->ID ) . '</a></span></li>';
            }
@jazzsequence
Copy link
Owner Author

This was submitted by Eric Deiter via email:

 //Iterate back to root
 while ($parent_id != 0) {
      $page = get_post($parent_id);
      $breadcrumbs[] = ‘<li><span typeof=“v:Breadcrumb”><a rel=“v:url” property=“v:title” href=“’ . get_permalink($page->ID) . ‘”>’ . get_the_title( $page->ID ) . ‘</a></span></li>’;
      //Get next parent, walk backwards
      $parent_id = $page->post_parent;
 }
 $breadcrumbs = array_reverse( $breadcrumbs );

Needs to be tested and patched

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant