• karimharo

    (@karimharo)


    Hello
    I found an issue in the function, I managed a website using wp fanzone theme and I always wondering why in the sub page we dont see a link to parent one.
    I got the fix

    you move sadly the echo out the foreach loop.
    current is
    ========

    } 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;

    ========

    Proposal fix is
    =========

    } 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;

    to keep the ancestors order (would better to get back echo inside but need to reorder fanzone_act list before)

    Karim

  • The topic ‘wp_fanzone_breadcrumb issue’ is closed to new replies.