Make WordPress Core

Opened 5 years ago

Closed 5 years ago

Last modified 5 years ago

#54281 closed defect (bug) (invalid)

wp_fanzone_breadcrumb bug

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

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
5 years ago

  • Description modified (diff)
  • Milestone Awaiting Review
  • Resolution → invalid
  • Status new → closed
  • Version trunk

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
5 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.