• I am making a theme in which I am using These plugins using TGM plugin installation link to git hub for theme link for github repo of my theme

    Advanced Custom Fields
    Kirki Customizer Framework
    my own plugin for theme
    Theme works like this

    Before activating theme we have to install Advanced Custom Fields & Kirki Customizer Framework. and inport there data also. as these plugins get some important values saved in variables that are called on front-page.php and other files.

    other wise my theme breaks the website & gives this kind of errors

    Fatal error: Uncaught Error: Class ‘Kirki’ not found in C:\Users\xampp\htdocs\wordpress\barber\wp-content\themes\saybers\inc\kirki-config.php:5 Stack trace: #0 C:\Users\xampp\htdocs\wordpress\barber\wp-content\themes\saybers\functions.php(173): require() #1 C:\Users\xampp\htdocs\wordpress\barber\wp-settings.php(497): include(‘C:\Users\xampp\…’) #2 C:\Users\xampp\htdocs\wordpress\barber\wp-config.php(90): require_once(‘C:\Users\xampp\…’) #3 C:\Users\xampp\htdocs\wordpress\barber\wp-load.php(37): require_once(‘C:\Users\xampp\…’) #4 C:\Users\xampp\htdocs\wordpress\barber\wp-admin\admin.php(34): require_once(‘C:\Users\xampp\…’) #5 C:\Users\xampp\htdocs\wordpress\barber\wp-admin\index.php(10): require_once(‘C:\Users\xampp\…’) #6 {main} thrown in C:\Users\xampp\htdocs\wordpress\barber\wp-content\themes\saybers\inc\kirki-config.php on line 5

    So what is the best way todo it or improve it and fix it?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Tom

    (@chapteradmin)

    I have same problem. Plugin not updated causing problems. Disabling plugin returns site to normal. Will wait for Brad to update.

    On the top of your theme’s kirki-config.php file you should add something like this:

    if ( ! class_exists( 'Kirki' ) ) {
      return;
    }

    The problem is that you’re trying to use something that doesn’t exist, and so naturally you get an error.
    As a rule of thumb, always check if a class exists before using it.

    Alternatively in your functions.php file instead of doing this:
    require get_template_directory( ).'/inc/kirki-config.php';
    do this:

    if ( class_exists( 'Kirki' ) ) {
      require get_template_directory( ).'/inc/kirki-config.php';
    }

    This is precisely why the themes in the WordPress repository are not allowed to require plugins. Themes should just do style and layout, regardless of what plugins are active.
    It is not the theme’s job to install plugins or data or even check that they exist. They should be independent.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘My Theme Generating this error’ is closed to new replies.