0
votes

I have this error in my wordpress, on frontend and dashboard:

Warning: require_once(includes/theme-widgets.php) [function.require-once]: failed to open stream: No such file or directory in /home/masqueci/public_html/functions.php on line 2

Fatal error: require_once() [function.require]: Failed opening required 'includes/theme-widgets.php' (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home/masqueci/public_html/functions.php on line 2

The problem is that I try to delete this line, rename the file, delete the all theme and delete wp-admin and wp-include and upload it again. But the error continue. How can I fix this problem?

1
Disable all the plugins and swap to the default theme TwentyTwelve/Thirteen, does it still happens? - brasofilo
No, i cant acces to dashboard. I delete the theme, but the error continue... - ThemesCreator

1 Answers

0
votes

Your problem is that you are using a worng reletive path to the file wanted.

Try on using:

$filePath = get_bloginfo('template_url'); // this line gets you the path to the current theme.
$filePath .= 'includes/theme-widgets.php'; // now we add the relative path to your file
require_once($filePath); // now we place the hole thing inside the 'require_once' function.

now you can minimize the code by:

require_once(get_bloginfo('template_url').'includes/theme-widgets.php');

what was originally responded by the function was that it was trying on going to: public_html/includes/theme-widgets.php which did not exist while your path was: public_html/wp-content/themes/{theme_name}/includes/theme-widgets.php

The code i have provided before should do the job for you :)