css_src — Get the URL to a local css file.

Asset-related functions

Summary

css_src() is a helper function used when referencing a css file within a theme, and commonly included within a theme’s header.php file. It returns the path to a css file located in the css folder of that theme, usually located in themes/YourTheme/css.

Note

The queue_css_file helper is preferred to this one for most use cases.

css_src($file, $dir = 'css', $version = OMEKA_VERSION)

Get the URL to a local css file.

Parameters:
  • $file (string) – Should not include the .css extension

  • $dir (string) – Defaults to ‘css’

  • $version (mixed) – Version number. By default OMEKA_VERSION.

Returns:

string

Usage

Examples

Add a link to a print.css file located in the theme’s css directory. Use when you need to load css files outside of the head.php file.

<head>
    <link href="<?php echo css_src('print'); ?>" media="all" rel="stylesheet" type="text/css" />
</head>

See Also