WOOF :: enqueue_theme_style( Array / String $file = style.css, Array $deps = array(), String $media = "all", Boolean $timestamp = true, String $default_extension = "css", String $parent = "auto" )

A wrapper for wp_enqueue_style which can more simply enqueue the standard style.css in your theme and assumes a base folder of THEME_DIR.

Note that this method runs all URLs through WOOF::theme_url which is child theme-aware, with the default setting being to look for files first in the child theme directory then the parent theme directory.

Note: in the example, we show this called directly in the template file before the call to wp_head(), but you also make use of the wp_enqueue_scripts action to call these functions. As long as the calls are before wp_head though, the effect is the same. 

Example:

Parameters:

  • Array / String $file = style.css

    An array or CSV string of file names. The CSV string may contain spaces for clarity, these will be trimmed. If specified as a string you may also use the format:
    sub_dir: filename1, filename2
    which will cause all files to be prefixed by the sub_dir as well as the default base directory.
    Note that this particular function is offered as a way to more simply enqueue the standard style.css, so it’s expected that you wouldn’t change any of these parameters from their defaults

  • Array $deps = array()

    An array of string IDs of previously registered stylesheets that must be loaded before this style.

  • String $media = "all"

    The media type the stylsheet is applicable to: E.g. ‘all’, ‘screen’, ‘handheld’, ‘print’.

  • Boolean $timestamp = true

    If true, a timestamp will be added to all URLs to ensure that as files change the URL will change too, which prevents unwanted caching.

  • String $default_extension = "css"

    An extension to use if you do not specify an extension in any of the filenames. Note: take care with this, as specifying a filename of “style.min” without the css extension will still be taken as having an extension (.min).

  • String $parent = "auto"

    Specifies where to look for the file, in the case of the current theme being a child-theme. If the active theme is not a child theme, this argument is essentially ignored. The following values are supported:

    • “auto” – Will look for the file first in the child theme folder and if not found will then check the folder of the parent theme.
    • false – Will only check for the file in the child theme. This will always return a URL as if the file exists, even if it does not.
    • true – Will only check for the file in the parent theme. This will always return a URL as if the file exists, even if it does not.

Latest From the Blog

MasterPress 1.4.1 is now available

27th May 2024

This update addresses backwards compatibility issues that were introduced in the previous update. There were some edge cases where PHP 7 had issues and it didn’t work at all on PHP 5.6. We have now changed it so that the PHP 8 compatibility changes will now only affect PHP 8 and will be more thorough… 

Plugin Requirements

MasterPress requires a minimum of WordPress version 4.9, MySQL 5.6, and PHP version 5.6.20.

We also recommend that PHP is configured to use a memory limit of 64MB per request (128MB may be required for sites with higher complexity).

This plug-in is not compatible with the WordPress.com hosted service.

Three AM