PHP Fatal error: Uncaught Error: Call to undefined method

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.

	 * df_get_header			
	 * @param -			
	 * @return -			
	static function df_get_header() {			
		$method =  self::get_page_type();		


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.

I certainly appreciate your help.

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?

Or, at least tell us what you are attempting to solve with this script? If we know what you are trying to do, we might have a solution for you.

This is script that came with the theme that contains the get_page_type. Hope this helps clarify what the script is trying to do.

* df_get_header_layout
* @return $selected_layout_type [type layout of header: boxed, fullboxed, fullwidth]
static function df_get_header_layout() {
$post_id = ‘’;
$general = self::df_get_general_options();
$global = $general[‘global’];
$selected_layout_type = ‘’;
$page_type = self::get_page_type();
case ‘df_single’:
if( is_attachment() ){
$selected_header_layout = ‘’;
$selected_topbar_status = ‘’;
$template_setting = self::df_get_template_setting_options();
$attachment_template = $template_setting[‘attachment_template’];
$header = $attachment_template[‘header_layout’];

					if( $header == 'inherit' ){
						$general = self::df_get_general_options();
						$global = $general['global'];
						$selected_layout_type = self::df_parse_header_option($global['header_layout']);
						$selected_layout_type = self::df_parse_header_option($header);
					$meta_layout = DF_CSS_Options::$metabox->header_style;
					$h = explode( "-", $meta_layout );
					$selected = $h[0]."_style_".$h[1];
					extract( self::df_get_header_selected( $selected ) );
					if( $selected == 'header_style_6'){
						$selected_layout_type = '';
						$selected_layout_type = $header_layout;	


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.

Sponsor our Newsletter | Privacy Policy | Terms of Service