Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding admin CSS in child themes #9

Open
lmartins opened this issue Dec 3, 2014 · 0 comments
Open

Adding admin CSS in child themes #9

lmartins opened this issue Dec 3, 2014 · 0 comments

Comments

@lmartins
Copy link

lmartins commented Dec 3, 2014

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 );
            } );
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant