skip to Main Content
  • WordPress 4.0.6
  • XAMPP 1.8.2 [Apache 2.4.4, MySQL 5.5.32, PHP 5.4.25, phpMyAdmin 4.0.4] or AMPPS 2.7
  • Theme: Directory 4.18 By AitThemes

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:xampphtdocsxitewp-contentthemesdirectorypage-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:xampphtdocsxitewp-contentthemesdirectorysingle.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:xampphtdocsxitewp-contentthemesdirectorycategory.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();

2

Answers


  1. Chosen as BEST ANSWER

    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.


  2. try with a backslash before the class name

    WpLatte::createPostEntity
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search