Skip to content

Instantly share code, notes, and snippets.

@davidverhage
Created November 16, 2021 09:10
Show Gist options
  • Save davidverhage/790a288e3abef9ad59c6ba25a47e8994 to your computer and use it in GitHub Desktop.
Save davidverhage/790a288e3abef9ad59c6ba25a47e8994 to your computer and use it in GitHub Desktop.
Wordpress Tip: keep your function.php file clean
<?php
//Loading all php files from the functions/ folder
//this keeps your wordpress functions file clean
//and you can split up your function build up by parsing functionality in different files.
$folder = get_template_directory()."/functions/";
$files = glob($folder."*.php"); // return array files
foreach($files as $phpFile){
require_once("$phpFile");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment