Page 1 of 1

Overload private functions in $Wcms?

Posted: Mon May 08, 2023 5:49 pm
by grimblefritz
I'm working on a new theme. I need a mostly new renderPageNavMenuItem(), which is defined as a private function in the Wcms class.

I don't do much PHP OOP stuff. Understand it barely enough to be dangerous.

Can I overload renderPageNaveMenuItem() and if so, how?

If not, then I can take a shot at modifying my theme.php to locally define that, and the menu() that calls it.

[SOLVED] Re: Overload private functions in $Wcms?

Posted: Tue May 09, 2023 5:32 pm
by grimblefritz
Never mind.

Instead, I copied menu() and renderPageNavMenuItem() into functions.php.

There, I made a few tweaks of $this to $Wcms.

In theme.php I call menu() instead of $Wcms->menu().

It's working, so now I can proceed with the theme.

There might be some gotcha with plugins or something, but not that I've found yet.