Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#54281 closed defect (bug) (invalid)

wp_fanzone_breadcrumb bug

Reported by: karimharo's profile karimharo Owned by:
Milestone: Priority: normal
Severity: normal Version:
Component: Themes Keywords:
Focuses: Cc:

Description (last modified by sabernhardt)

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

Change History (2)

#1 @sabernhardt
3 years ago

  • Description modified (diff)
  • Milestone Awaiting Review deleted
  • Resolution set to invalid
  • Status changed from new to closed
  • Version trunk deleted

Hi and welcome to WordPress Trac!

This is not a core problem; it's in the WP FanZone theme. Thank you for reporting this already on their support forum, where it belongs.
https://wordpress.org/support/topic/wp_fanzone_breadcrumb-issue/

#2 @karimharo
3 years ago

Hi
Ok
I was not sure that forum was the right place to

Thank you

Note: See TracTickets for help on using tickets.