2014-10-24 4 views
0

아마 ussual으로 어리석은 일이지만 .. 내 style.css 또는 custom.css를 사용하여 부트 스트랩 CSS를 무시할 수 없습니다.부트 스트랩 및 워드 프레스 문제

//Enqueue scripts and styles 
function horizon_scripts() { 
    //Load the theme CSS 

    wp_enqueue_style('bootstrap', get_template_directory_uri() . '/bootstrap/css/bootstrap.min.css'); 
    wp_enqueue_style('main', get_template_directory_uri() . '/style.css'); 

    // Register the script like this for a theme: 
    wp_register_script('custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.js', array('jquery')); 

    wp_register_script('custom-script', get_template_directory_uri() . '/bootstrap/js/bootstrap.min.js', array('jquery')); 

    wp_register_script('custom-script', get_template_directory_uri() . '/bootstrap/css/custom.css', array(), '1.0.1', 'all'); 

    // For either a plugin or a theme, you can then enqueue the script: 
    wp_enqueue_script('custom-script'); 
} 

    add_action('wp_enqueue_scripts', 'horizon_scripts'); 
: 나는

지금 내가 이렇게 내 functions.php에 추가 할 시도 .. 그게 내가 생각을 할 수있는 방법은 정말하지 않기 때문에 내 헤더 파일에 내 모든 사용자 정의 CSS를 넣어 싶지 않아

그래서 먼저 다음 내 부트 스트랩 CSS를로드 당신은있는 style.css 및 custom.css하지만 확실히 그것을 명중하지 않았다 .. 그래서 어떤 도움을 주시면 감사하겠습니다

:

+0

그냥 시도했지만 아직 안된다 –

답변

0

를 사용한다 get_stylesheet_directory_uri(). 여기 JS하지 않고, 단지 CSS의 : wp_enqueue_style()의 세 번째 매개 변수는 "종속"입니다

function horizon_scripts() { 
    wp_enqueue_style('bootstrap', get_stylesheet_directory_uri() . '/bootstrap/css/bootstrap.min.css'); 
    wp_enqueue_style('main', get_stylesheet_uri(), array('bootstrap')); 
    wp_enqueue_style('custom', get_stylesheet_directory_uri() . '/custom.css', array('main')); 
} 
add_action('wp_enqueue_scripts', 'horizon_scripts'); 

하는 것으로. 더 읽기 in the Codex.

+0

고맙습니다. 마침내 작동하게되었습니다. Google은 이번에는 도움이되지 않았지만 다음과 같이했습니다. D –

관련 문제