Register a UIkit theme.
The theme must not contain sub-folders. Component files in the theme will be automatically combined to the UIkit compiler if that component is used.
This function must be called in the ‘beans_uikit_enqueue_scripts’ action hook.
beans_uikit_register_theme( string $id, string $path )
Return: (bool) False on error or if already exists, true on success.
Parameters
Name | Type | Required | Default | Description |
---|---|---|---|---|
$id | string | true | - | A unique string used as a reference. Similar to the WordPress scripts $handle argument. |
$path | string | true | - | Absolute path to the UIkit theme folder. |
Source
function beans_uikit_register_theme( $id, $path ) {
global $_beans_uikit_registered_items;
// Stop here if already registered.
if ( beans_get( $id, $_beans_uikit_registered_items['themes'] ) ) {
return true;
}
if ( ! $path ) {
return false;
}
if ( false !== stripos( $path, 'http' ) ) {
$path = beans_url_to_path( $path );
}
$_beans_uikit_registered_items['themes'][ $id ] = trailingslashit( $path );
return true;
}