queue_css_file
— Add a CSS file or files to the current page.
Summary
- queue_css_file($file, $media = 'all', $conditional = false, $dir = 'css', $version = OMEKA_VERSION)
Add a CSS file or files to the current page.
All stylesheets will be included in the page’s head. This needs to be called either before head(), or in a plugin_header hook.
- Parameters:
$file (
string|array
) – File to use, if an array is passed, each array member will be treated like a file.$media (
string
) – CSS media declaration, defaults to ‘all’.$conditional (
string|bool
) – IE-style conditional comment, used generally to include IE-specific styles. Defaults to false.$dir (
string
) – Directory to search for the file. Keeping the default is recommended.$version (
mixed
) – Version number. By default OMEKA_VERSION.
Usage
head_css
actually outputs the stylesheet markup. All themes should already call head_css
themselves,
so you can just use the queue functions.
If writing a theme, queue_css_*
functions must be called before the call to head_css
. If writing a plugin,
you make these calls within the admin_head or public_head hooks.
Examples
Include the CSS file style.css
located in the css
folder in your theme:
<?php queue_css_file('style'); ?>
Load multiple CSS files using an array:
<?php queue_css_file(array('style', 'screen')); ?>
Load a CSS file and add a media query:
<?php queue_css_file('media/960min', 'only screen and (min-width: 960px)'); ?>