Last active
March 25, 2016 10:52
-
-
Save JeppeSigaard/fcb76e7a2509ed16dc62 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function smamo_include_functions_part_if_exists($fetch, $in = false){ | |
if ($in){$fetch = $in . '/' . $fetch;} | |
$fetch = get_template_directory() . '/' . $fetch . '.php'; | |
if(file_exists($fetch)){include_once $fetch;} | |
} | |
function get_functions_part($fetch, $in = false){ | |
if(is_array($fetch)){foreach($fetch as $p){smamo_include_functions_part_if_exists($p,$in);}} | |
else{smamo_include_functions_part_if_exists($fetch,$in);} | |
} | |
/* | |
Example use: | |
get_functions_part(array( | |
'images', | |
'menus', | |
'widgets', | |
'header-img', | |
), 'functions/theme-support'); | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment