Custom WordPress functions files are not loading

I’m building WordPress theme with Redux Framework.

I’ve created some files for custom funstions and other system files (bootstrap nav_walker css file, etc.)

My Options page working. But, included files not working. Taking 404 error for included files.

functions.php

<?php

/**
 * @author   abcthemes
 * @since    1.0
 * @package  abc
 */

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

/*
 * Class
 * v: 1.0
 */
if ( ! class_exists( 'abcthemes' ) ) :

    /**
     * The main abcthemes class
     */
    class abcthemes {

        /**
         * Setup class.
         *
         * @since 1.0
         */
        public function __construct() {
            add_action( 'after_setup_theme',          array( $this, 'setup' ) );
            add_action( 'widgets_init',               array( $this, 'widgets_init' ) );
            add_action( 'wp_enqueue_scripts',         array( $this, 'scripts' ), 10 );
        }

        /**
         * Sets up theme defaults and registers support for various WordPress features.
         *
         * Note that this function is hooked into the after_setup_theme hook, which
         * runs before the init hook. The init hook is too late for some features, such
         * as indicating support for post thumbnails.
         */     
        public function setup() {

            /*
             * Add Redux Framework
             */
            require get_template_directory() . '/inc/admin/admin-init.php';         

            /**
            * Add default posts and comments RSS feed links to head.
            */
            add_theme_support( 'automatic-feed-links' );

            /*
            * Enable support for Post Thumbnails on posts and pages.
            *
            * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
            */          
            add_theme_support('post-thumbnails');

            /**
            * Menu Settings
            */          
            register_nav_menus( array(
                'primary' => __('Main Menu', 'abcthemes'),
            ) );

            /*
            * Switch default core markup for search form, comment form, comments, galleries, captions and widgets
            * to output valid HTML5.
            */
            add_theme_support( 'html5', array( 'search-form','comment-form','comment-list','gallery','caption','widgets' ) );

            // Declare support for title theme feature.
            add_theme_support( 'title-tag' );           

        }

        /**
         * Register widget area.
         *
         * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
         */
        public function widgets_init() {
            register_sidebar( array(
                'name'          => __( 'Sidebar', 'abcthemes' ),
                'id'            => 'sidebar-1',
                'description'   => 'Genel Bileşen Alanı',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) );
            register_sidebar( array(
                'name'          => __( 'Home', 'abcthemes' ),
                'id'            => 'home-1',
                'description'   => 'Home Sidebar',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) ); 
            register_sidebar( array(
                'name'          => __( 'Footer - 1', 'abcthemes' ),
                'id'            => 'footer-1',
                'description'   => 'Footer 1',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) );
            register_sidebar( array(
                'name'          => __( 'Footer - 2', 'abcthemes' ),
                'id'            => 'footer-2',
                'description'   => 'Footer 2',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) );
            register_sidebar( array(
                'name'          => __( 'Footer - 3', 'abcthemes' ),
                'id'            => 'footer-3',
                'description'   => 'Footer 3',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) ); 
            register_sidebar( array(
                'name'          => __( 'Footer - 4', 'abcthemes' ),
                'id'            => 'footer-4',
                'description'   => 'Footer 4',
                'before_widget' => '<aside id="%1$s" class="widget %2$s">',
                'after_widget'  => '</aside>',
                'before_title'  => '<div class="widget-title"><h3><span>',
                'after_title'   => '</span></h3></div>',
            ) );             
        }       

        /**
         * abcthemes Styles and Scripts
         * Enqueue scripts and styles.
         */
        public function scripts() { 

            wp_deregister_script('jquery');  
            wp_deregister_script('jquery-migrate');         

            /**
            * Enqueue Styles.
            */
            wp_enqueue_style( 'main', get_stylesheet_directory_uri() . '/assets/css/main.min.css', array(), NULL );
            wp_enqueue_style( 'style', get_stylesheet_uri(), array(), NULL );

            /**
             * Enqueue Scripts.
             */ 
            wp_enqueue_script( 'jquery', '/wp-includes/js/jquery/jquery.js', FALSE, NULL, TRUE );
            wp_enqueue_script( 'jquery-migrate', '/wp-includes/js/jquery/jquery-migrate.min.js', FALSE, NULL, TRUE );
            wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array(), NULL, TRUE );                

            if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
                wp_enqueue_script( 'comment-reply' );
            }
        }
    }
endif;
return new abcthemes();

// Not Loaded
require_once get_template_directory() . '/inc/theme-functions.php';
require_once get_template_directory() . '/inc/wp_bootstrap_navwalker.php';
require_once get_template_directory() . '/inc/clean-header.php';

//Content Types - Not Loaded
require_once get_template_directory() . '/inc/content-types/products-content-type.php';
require_once get_template_directory() . '/inc/content-types/product-categories-taxonomies.php';
require_once get_template_directory() . '/inc/content-types/references-content-type.php';
require_once get_template_directory() . '/inc/content-types/products-metaboxes.php';

//Widgets - Not Loaded
require_once get_template_directory() . '/inc/widgets/sidebar-latest-news.php';

//Templates - Not Loaded
require_once get_template_directory() . '/inc/custom-templates/template-archive.php';
require_once get_template_directory() . '/inc/custom-templates/template-contact.php';
require_once get_template_directory() . '/inc/custom-templates/template-products.php';
require_once get_template_directory() . '/inc/custom-templates/template-references.php';
require_once get_template_directory() . '/inc/custom-templates/template-archive.php';

After Main Class, other files not loading.

Example for Bootstrap Navwalker;

( ! ) Fatal error: Class 'WP_Bootstrap_Navwalker' not found in C:...header.php on line 51

Header.php Line 51;

                    wp_nav_menu( array(
                        'theme_location'    => 'primary',
                        'depth'             => 2,
                        'container'         => 'div',
                        'container_class'   => 'collapse navbar-collapse js-navbar-collapse',
                        'container_id'      => 'js-navbar-collapse',
                        'menu_class'        => 'nav navbar-nav navbar-right',
                        'fallback_cb'       => 'WP_Bootstrap_Navwalker::fallback',
                        'walker'            => new WP_Bootstrap_Navwalker()) // Line 51
                    );

Read more here: Custom WordPress functions files are not loading

Leave a Reply

Your email address will not be published. Required fields are marked *