Last active
September 1, 2019 14:59
-
-
Save macariojames/fced3f8bc6bb65634ea4a642c6f4e571 to your computer and use it in GitHub Desktop.
WordPress: function to display template directory based on needs, such as CSS, images, js files, etc.
This file contains hidden or 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 | |
// echo relevant directory ~mj | |
function print_dir($type) { | |
if($type === '') | |
$dir = get_template_directory_uri(); | |
else if ($type === 'js') | |
$dir = get_template_directory_uri() . '/public/js/'; | |
else if ($type === 'css') | |
$dir = get_template_directory_uri() . '/public/css/'; | |
else if ($type === 'images') | |
$dir = get_template_directory_uri() . '/public/images/'; | |
return $dir; | |
} | |
// usage echo print_dir('images'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment