queue_css_file — Add a CSS file or files to the current page.

Asset-related functions


queue_css_file($file, $media = 'all', $conditional = false, $dir = 'css')

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.

  • $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.



Identify the CSS files located in the ‘css’ folder in your theme directory. CSS files queued here will be printed to the page head with the head_css() function :

<?php queue_css_file('style'); ?>

<?php head_css(); ?>

Load multiple CSS files using an array:

<?php queue_css_file(array('style', 'screen')); ?>

<?php head_css(); ?>

Load a CSS file from a folder within the default ‘css folder’ and add a conditional statement:

<?php queue_css_file('media/960min', 'only screen and (min-width: 960px)'); ?>

<?php head_css(); ?>