Skip to content

Adding admin CSS in child themes #9

@lmartins

Description

@lmartins

How can I pass a CSS when using Jigsaw in a child theme?
The function creates the file URL with the get_template_directory_uri() which always retrieves the parent theme location instead of the child theme.

Any way to get around it?

static function add_admin_js_or_css( $file, $function = 'wp_enqueue_style' ) {
        if ( !is_admin() ) {
            return;
        }
        if ( !file_exists( ABSPATH.$file ) ) {
            $file = trailingslashit( get_template_directory_uri() ).$file;
        }
        add_action( 'admin_enqueue_scripts', function() use ( $file, $function ) {
                $function( sanitize_title( $file ), $file );
            } );
    }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions