Created
June 9, 2010 21:11
-
-
Save whalesalad/432180 to your computer and use it in GitHub Desktop.
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 | |
| // Handy little media function | |
| function media($rsrc) { | |
| return get_stylesheet_directory_uri().'/'.$rsrc; | |
| } | |
| // Helper function, accepts a string or an array of strings. Will spit out some css includes | |
| function media_css($rsrc) { | |
| if (is_array($rsrc)) { | |
| $media = array(); | |
| foreach ($rsrc as $key => $resource) { | |
| $media[] = media_css($resource); | |
| } | |
| return implode("", $media); | |
| } else { | |
| return sprintf('<link rel="stylesheet" type="text/css" href="%s" />'."\n", media($rsrc)); | |
| } | |
| } | |
| // Helper function, accepts a string or an array of strings. Will spit out some script includes | |
| function media_js($rsrc) { | |
| if (is_array($rsrc)) { | |
| $media = array(); | |
| foreach ($rsrc as $key => $resource) { | |
| $media[] = media_js($resource); | |
| } | |
| return implode("", $media); | |
| } else { | |
| return sprintf('<script type="text/javascript" src="%s"></script>'."\n", media($rsrc)); | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment