bigpont라는 부모 테마의 WordPress에서 하위 테마를 만들었습니다. 나는 또한 사이트에서 woocommerce를 사용하고있다. 나는 내 자식 테마 스타일 시트를 훔쳐서 두 번로드되는 것을 알아 차렸고 이유가 확실하지 않습니다. 또한 woocommerce 스타일 시트를 오버라이드하도록로드하는 방법을 궁금합니다. 여기에 내가 현재 내 functions.php 파일에 사용하고 코드입니다 :WordPress의 하위 테마에 대한 스타일 시트 대기열
function my_theme_enqueue_styles() {
$parent_style = 'bigpoint-css';
wp_enqueue_style($parent_style, get_template_directory_uri() . '/base.css');
wp_enqueue_style('child-style',
get_stylesheet_directory_uri() . '/style.css',
array($parent_style),
wp_get_theme()->get('Version')
);
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_styles');
을 여기에 스타일 시트가 내 사이트에로드되는 방법입니다 'bigpoint 기본-CSS'으로로드 할 것 다시 "아이 스타일 CSS"를 추가했습니다.
**** 업데이트 : 내 부모 테마의 functions.php 파일에서 두 번째로로드되는 내 CSS에 대한 답변을 찾았습니다 :
wp_register_style('bigpoint-default', get_stylesheet_uri(), '1.0');
그래서 나는 s는 그 취소 : 당신은 낮은과 스크립트를 대기열 경우 WooCommerce 그래서 10
public static function init() {
add_action('wp_enqueue_scripts', array(__CLASS__, 'load_scripts'));
add_action('wp_print_scripts', array(__CLASS__, 'localize_printed_scripts'), 5);
add_action('wp_print_footer_scripts', array(__CLASS__, 'localize_printed_scripts'), 5);
}
의 기본 우선 순위로 스크립트/스타일을 큐에 넣 같은
function unhook_parent_style() {
wp_dequeue_style('bigpoint-default');
wp_deregister_style('bigpoint-default');
}
add_action('wp_enqueue_scripts', 'unhook_parent_style', 20);
Woocommerce CSS 후에 내 스타일 시트를로드하는 데 도움이 된 Andrew에게 감사드립니다. 나는 부모 테마 functions.php 파일에서 이것을 발견했는데 그것이 내 css 파일의 다른 로딩이 일어나는 곳이다. wp_register_style ('bigpoint-default', get_stylesheet_uri(), '1.0'); 하지만 내 자신의 functions.php 파일에서 어떻게 처리해야할지 모르겠습니다. –
모든 코드를 볼 수없는 경우 해당 질문에 대답 할 수 없습니다. –
나는 그것을 이해하고 나의 질문에 게시, wordpress 초보자를 도와 주셔서 감사합니다 :) –