Skip to content

Instantly share code, notes, and snippets.

@JeppeSigaard
Last active March 25, 2016 10:52
Show Gist options
  • Save JeppeSigaard/fcb76e7a2509ed16dc62 to your computer and use it in GitHub Desktop.
Save JeppeSigaard/fcb76e7a2509ed16dc62 to your computer and use it in GitHub Desktop.
<?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