Hi I’m having trouble with a PHP Fatal error: Uncaught Error: Call to undefined method DF_Header::() in /home2/erskine3/public_html/thegeelongeditioncom/wp-content/themes/onfleek/inc/df-core/df-front-end/df-header.php:219
As I am a novice in this area I was hoping someone could see what is wrong with the code below to throw the error.
Well, not sure what you are trying to do, but, I will guess you are attempting to return the value.
To fix that, you would need to change the last line to:
return self::$method;
But, note that there is no method function set up. You created a variable $method not a real object.
So, no paren’s on that return line… Not sure if that was your question…
Thanks so much, unfortunately that did not work. It may be my description of the problem not your solution.
I didn’t the write the code it came with the theme but our website crashes regularly and throws up the 500 internal server error. When I check wordfence error log this is the consistent error that appears.
Do you require more of the code to decipher what it is meant to do.
The line $method = self::get_page_type(); is calling the function get_page_type to get a method name to call in the next line self::$method();; get_page_type should return the name of a method in the current class; It looks like it’s returning nothing though. PHP is then casting that null value to a string to try and call as a method; most “emptyish” values in PHP, when cast to a string, will give "" - that is, an empty string. So $method is casting to an empty string, and the line self::$method() is trying to call a class method named literally nothing.
Can you edit your question to include the code for get_page_type?
The code above doesn’t include the method get_page_type; you’re looking for a block of code that looks something like:
function get_page_type(...) {
...
}
As an aside, this is a very basic structure in PHP and other languages. You might struggle to understand any solution we can give you if you don’t get your head round this stuff. I’d have a look through some sort of getting started guide before diving too deep into this.