[wp-trac] [WordPress Trac] #54281: wp_fanzone_breadcrumb bug

WordPress Trac noreply at wordpress.org
Sun Oct 17 08:59:52 UTC 2021


#54281: wp_fanzone_breadcrumb bug
--------------------------+----------------------
 Reporter:  karimharo     |       Owner:  (none)
     Type:  defect (bug)  |      Status:  closed
 Priority:  normal        |   Milestone:
Component:  Themes        |     Version:
 Severity:  normal        |  Resolution:  invalid
 Keywords:                |     Focuses:
--------------------------+----------------------
Changes (by sabernhardt):

 * status:  new => closed
 * version:  trunk =>
 * resolution:   => invalid
 * milestone:  Awaiting Review =>


Old description:

> 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

New description:

 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

--

Comment:

 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/

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/54281#comment:1>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list