WordPress Functions.php and load external files

In WordPress, you can use this code to load sidebars or widgets.

//load the sidebars and middlebars
require(get_template_directory() . '/bars/sidebars.php');

// custom widgets
require( get_template_directory() . '/widgets/widgets.php' );

The previous code is a smart solution since in order the sidebars or the widgets you need to update specific files instead to update the whole functions.php file.

tags: & category: -