0

I created styles for custom field, that is a radio button.

The style affects every .inside ul.acf-radio-list.radio.horizontal li label but I want the style to work only on the Edit Post functionality.

How can I do that?

1 Answer 1

0

Add your styles to /your-theme/admin-edit-post.css

.inside ul.acf-radio-list.radio.horizontal li label {
 /* styles... */
}

Then enqueue the styles by adding this to your theme's functions.php:

function wpse250000_admin_styles( $hook ) {
    // Bail if we're not on the post.php admin page
    if ( 'post.php' !== $hook ) {
        return;
    }

    // Ensure we're looking at a post. Add other post types to array if desired.
    $post_type = get_post_type();
    if ( ! $post_type || ! in_array( $post_type, [ 'post' ] ) ) {
        return;
    }

    wp_enqueue_style( 'admin-edit-post-styles', get_template_directory_uri() . '/admin-edit-post.css' );
}
add_action( 'admin_enqueue_scripts', 'wpse250000_admin_styles' );

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.