Because We Love Happy Coding


solution to Warnings of Pitch_Walker_Page in wordpress theme "pitch"

I was looking for a wordpress theme that's go well with custom post types. Only a few choice I could find... and this "pitch" looks good to me.

But when I activated it, I found a Warning.

Warning: Declaration of Pitch_Walker_Page::start_el(&$output, $page, $depth, $args, $current_page = 0) should be compatible with Walker_Page::start_el(&$output, $page, $depth = 0, $args = Array, $current_page = 0) in /home/[blog_name]/public_html/wp-content/themes/pitch/functions.php on line 435

I googled it.

Official Forum

Official Forum ends up with "Thread resolved via alternative support channel". Mmm...

This means at least I am not the only one who met this warning. This happens in some conditions.

Another hint here.

The Answer by JHoffmann suggests this is error comes from extension. Child class extends from parent class, and child's signature should be the same with parent's. Signature here means parameter list, i.e. keywords in parensis. JHoffmann suggests to copy the parent's signature to child's. OK, I will try.

Solution for me.

Open functions.php in theme/pitch/ directory and see line 446.

function start_el(&$output, $page, $depth, $args, $current_page = 0) 

Change this line to the following.

function start_el( &$output, $page, $depth = 0, $args = array(), $current_page = 0 ) {

This worked perfectly for me.