Header and footer php errors

Hi,

I’m getting the two errors below in my dashboard.

I read another Support thread which says the plugin Ultimate Social (which I have) causes this and you recommended using a wp_head hook, but I have no idea what that is - yes, I read the article, but I’m still none the wiser, so please don’t just send me that link. I use a child theme, by the way.

Please give me the code I need to add and say, step-by-step, how and where it should be added.
Thanks,
Steve

Error : Please fix your theme to make plugins work correctly: Go to the Theme Editor and insert <?php wp_head(); ?> just before the line of your theme’s header.php file.

Error : Please fix your theme to make plugins work correctly: Go to the Theme Editor and insert <?php wp_footer(); ?> as the first line of your theme’s footer.php file.

Hi there,

Thanks for writing in.

You don’t need to fix that, our theme already has the wp_head() added to the templates. You probably using a tool that suggests on how your theme should be set up. Please note that Wordpress has template and template parts, hence, it could be added in multiple ways and in different locations. It’s not always in header.php and footer.php, you should ignore that since it’s not an actual error.

Thanks!

Hi,
I can’t ignore it because the plugin doesn’t work!

Plus, that’s not the advice your Support has given on other threads in the forum that deal with the same problem and the same plugin.

I need this fixing, please.

Hey there,

X uses wp_head and wp_footer. You’ll find those in

wp-content\themes\x\framework\views\header\base.php
wp-content\themes\x\framework\views\footer\base.php

Also this error looks like it’s generated by a plugin that is poorly coded. If it is using WordPress standards, it should not give such error.

Thanks.

That’s exactly what the plugin developer said about X Theme throwing up these errors.

How am I ever supposed to fix it when I don’t even know who do I believe???

I specifically told you I’d like step-by-step instruction and you’ve just ignored that and given me “support” which is of no use at all.

Hello Steve123,

Thanks for updating in!

You do not have to fix it. This isn’t an error with regards to WordPress standards at all. Your plugin is displaying it as if it is an error according to the plugin. If this is an error at all, your website will not be displaying correctly or even anything on the page. Do you know that wp_head() loads the css stylesheet and wp_footer() is loading all the js files? If these functions were none existent in X theme, then nothing should working.

Please ignore this warning. Your plugin does not recognize the template structure of X. If there is a need to add a piece of code in the wp_head() coming from the plugin so that it will work, you will have to do the following steps:
1.) Please install a child theme. Because what you are trying to accomplish requires a template customization, we would highly to suggest that you use a child theme. This allows you to make code changes that won’t be overwritten when an X update is released.

2.) Using Notepad or TextEdit or Sublime Text or any text editor, please create a new file in your local machine.

3.) Insert the following code into that new file

<?php

// =============================================================================
// VIEWS/HEADER/BASE.PHP
// -----------------------------------------------------------------------------
// Declares the DOCTYPE for the site, includes the <head>, opens the <body>
// element as well as the .x-root <div> and .x-site <div>.
// =============================================================================

$x_root_atts = x_atts( apply_filters( 'x_root_atts', array( 'id' => 'x-root', 'class' => 'x-root' ) ) );
$x_site_atts = x_atts( apply_filters( 'x_site_atts', array( 'id' => 'x-site', 'class' => 'x-site site' ) ) );

?>

<!DOCTYPE html>

<html class="no-js" <?php language_attributes(); ?>>

<head>
  <?php wp_head(); ?>

  <?php // add the code here ?>

</head>

<body <?php body_class(); ?>>

  <div <?php echo $x_root_atts; ?>>

    <?php do_action( 'x_before_site_begin' ); ?>

    <div <?php echo $x_site_atts; ?>>

    <?php do_action( 'x_after_site_begin' ); ?>

4.) Save the file named as base.php

5.) Upload this file to your server in the child theme’s folder wp-content\themes\x\framework\views\header\

If no code has been provided by the plugin, it should automatically inject the code using the the hook or filter for the wp_head() or wp_footer(). Just sit back and let the plugin integrate with X theme.

Hope this would explain briefly.

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.