我为自定义字段创建了样式,这是一个单选按钮。
样式影响每个.inside ul.acf-radio-list.radio.horizontal li label
但我希望该样式仅适用于编辑帖子功能。
我该怎么做?
我为自定义字段创建了样式,这是一个单选按钮。
样式影响每个.inside ul.acf-radio-list.radio.horizontal li label
但我希望该样式仅适用于编辑帖子功能。
我该怎么做?
将样式添加到/your-theme/admin-edit-post.css
.inside ul.acf-radio-list.radio.horizontal li label {
/* styles... */
}
然后通过将其添加到主题的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\' );
function my_theme_enqueue_styles() { wp_enqueue_style( \'twentytwentyone-style\', get_template_directory_uri() . \'/style.css\' ); wp_enqueue_style( \'child-style\', get_stylesheet_directory_uri() . \'/style.css\',