[wp-trac] [WordPress Trac] #54281: wp_fanzone_breadcrumb bug
WordPress Trac
noreply at wordpress.org
Sun Oct 17 08:15:17 UTC 2021
#54281: wp_fanzone_breadcrumb bug
--------------------------+-----------------------------
Reporter: karimharo | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: Themes | Version: trunk
Severity: normal | Keywords:
Focuses: |
--------------------------+-----------------------------
Hello
you used foreach loop but the variable output is overwritten and the echo
is only showing the last path, so all parent pages are not shown in the
breadcrumb
indeed in functions.php
"
} elseif (is_page()) {
if($post->post_parent){
$fanzone_act = get_post_ancestors( $post->ID );
$title = get_the_title();
foreach ( $fanzone_act as $fanzone_inherit ) {
$output = '<li><a
href="'.get_permalink($fanzone_inherit).'"
title="'.get_the_title($fanzone_inherit).'">'.get_the_title($fanzone_inherit).'</a></li>
<li class="separator">/</li>';
}
echo $output;
"
a potential fix is (but limitation with variable size ) :
"
} elseif (is_page()) {
if($post->post_parent){
$fanzone_act = get_post_ancestors( $post->ID );
$title = get_the_title();
$output="";
foreach ( $fanzone_act as $fanzone_inherit ) {
$output = '<li><a
href="'.get_permalink($fanzone_inherit).'"
title="'.get_the_title($fanzone_inherit).'">'.get_the_title($fanzone_inherit).'</a></li>
<li class="separator">/</li>' . $output;
}
echo $output;
"
that keeps the right order of ancestors
BR
Karim
--
Ticket URL: <https://core.trac.wordpress.org/ticket/54281>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list