I'm just analyzing my custom Walker Class because it frequently skips over some post_meta data that I append to the $output HTML.

Even though the Custom Fields are set, they are ignored by the Walker. They are only shown when I go back to my functions.php, and re-run the function that sets the Custom Fields.

The extract function is used to obtain the arguments and skips over the arguments with the new ones provided in the walker.

invalid/numeric keys and collisions are Skipped in this case, so I would assume that my Custom Walker is being run each time.

I'll give an example of how it obtains the Custom Field:

$CommentCount = get_post_meta($page->ID, 'num_comments_in_Tree', true);
        $CommentCount = "";
    }else{$CommentCount = '&nbsp;<span style="font-size:.75em">
    comments: (' . get_post_meta($page->ID, 'num_comments_in_Tree', true)
    . ')</span>&nbsp;';}

    $MetaOutput = $CountChildren . $PageLastModifiedDate . 
    $CommentCount . $LastCommentDate . $Description;

    $output .= $indent . 
                '<li><div class="link"><a href="' . get_page_link($page->ID) . '" title="' . 
                esc_attr( wp_strip_all_tags( apply_filters( 'the_title', $page->post_title, $page->ID ) ) ) . '">' . 
                $link_before . apply_filters( 'the_title', $page->post_title, $page->ID ) . $link_after . '</a>' . $MetaOutput . '</div>';

^See the end of the last line for the $MetaOutput.

I don't know why, if the Custom Fields are set on each page, they will only show if I re-run the function that sets the Custom Fields.


I ended up running the function twice on itself. That way, once the walker updated the last element, it went back up to the top to update the first.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.