Reputation: 73
I'm working on a backup of an old site from early 2015, however I'm getting the error below. Everything works fine except when I try to load/live view the site content.
The specific file changes depending on what content I try to view. post, category, image-page etc
How do I fix this?
When trying to view home page:
Fatal error: Class 'WpLatte' not found in E:\xampp\htdocs\xite\wp-content\themes\directory\page-dir-home.php on line 14
Line 14 to 19:
$latteParams['post'] = WpLatte::createPostEntity(
$GLOBALS['wp_query']->post,
array(
'meta' => $GLOBALS['pageOptions'],
)
);
- e.g. When trying to view a post. Fatal error: Class 'WpLatte' not found in E:\xampp\htdocs\xite\wp-content\themes\directory\single.php on line 2
Entire code of single.php:
<?php
$latteParams['post'] = WpLatte::createPostEntity(
$GLOBALS['wp_query']->post,
array(
'meta' => $GLOBALS['pageOptions'],
)
);
ob_start();
comments_template('');
ob_get_clean();
/**
* Fire!
*/
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
- e.g. When trying to view a category. Fatal error: Class 'WpLatteCategoryEntity' not found in E:\xampp\htdocs\xite\wp-content\themes\directory\category.php on line 10
Entire code of category.php. Line 10 starts $latteParams['category'] = new
<?php
/**
* AIT WordPress Theme
*
* Copyright (c) 2012, Affinity Information Technology, s.r.o. (http://ait-themes.club)
*/
$latteParams['category'] = new WpLatteCategoryEntity($wp_query->queried_object);
$latteParams['posts'] = WpLatte::createPostEntity($wp_query->posts);
WPLatte::createTemplate(basename(__FILE__, '.php'), $latteParams)->render();
Upvotes: 0
Views: 39
Reputation: 73
Since the Wordpress backend was working flawlessly fine, I figured the issue was with the theme.
Found that wp-content/themes/directory/functions.php
wasn't being loaded. Not sure why.
Switched to the default theme, deleted the Directory theme, re-uploaded it without the functions.php file. Used Notepad++ to create and save a functions.php file in which I copy-pasted the required code.
Restarted XAMPP, switched back to the Directory theme and everything loaded fine.
Upvotes: 0
Reputation: 541
try with a backslash before the class name
\WpLatte::createPostEntity
Upvotes: 0