2013-04-25 3 views
-2

작동하지 나는 워드 프레스에 게시물을 얻을 수있는 쿼리가 있습니다. 슬라이더 마크 업이로드되지만 플러그인에 필요한 javascript 및 css 파일이 소스 코드에 표시되지 않습니다. 이 문제를 어떻게 해결할 수 있습니까?워드 프레스 get_page() 및 플러그인 단축 코드가

+0

소스 코드 또는 페이지 링크가이 코드보다 훨씬 유용합니다. 스크립트를 대기열에 넣어야하는 부분과 아무 관련이 없습니다. – krembo99

답변

0

당신은 상대 소스 코드 나 링크를 제공하지 않았지만 JS와 CSS를로드 했습니까? 슬라이더가 플러그인에서 제공됩니까? 그것은 당신의 플러그인입니까? 해당 페이지에 대해 활성화 된 플러그인입니까? 당신 enqueue 스타일과 스크립트를 했습니까 ??

어쨌든, 첫 번째 조치로, 당신은 단순히 시도 할 수 있습니다 빠른 디버그를 들어 페이지

function my_scripts_enq() 
{ 
    // Register the script for a plugin: 
    wp_register_script('custom-script', plugins_url('/js/custom-script.js', __FILE__)); 
    // or 
    // Register the script for a theme: 
    wp_register_script('custom-script', get_template_directory_uri() . '/js/custom-script.js'); 

    // then enqueue the script: 
    wp_enqueue_script('custom-script'); 
} 
add_action('wp_enqueue_scripts', 'my_scripts_enq'); 

에 수동으로로드하려고 : 스타일에

if(is_page(42)){ 
add_action('wp_enqueue_scripts', 'my_scripts_enq'); 
} 

당신이 수행해야합니다

function load_styles() 
{ 
    // Register the style for a plugin: 
    wp_register_style('custom-style', plugins_url('/css/custom-style.css', __FILE__), array(), '20120208', 'all'); 
    // or 
    // Register the style for a theme: 
    wp_register_style('custom-style', get_template_directory_uri() . '/css/custom-style.css', array(), 'se16205117', 'all'); 

    // then enqueue the style: 
    wp_enqueue_style('custom-style'); 
} 
add_action('wp_enqueue_scripts', 'load_styles'); 

BTW - 보조 메모로 codex

$page_id = 2; 
$page_data = get_page($page_id); 

// get_page 함수에 변수를 전달해야합니다. 값에 을 전달하면 (예 : get_page (123);) WordPress에서 오류가 발생합니다. 기본적으로 이것은 객체를 반환합니다.

+0

ID가 변수에 있는지 여부는 중요하지 않습니다. 함수는 정수 값을 허용합니다. – tlaverdure

+1

오른쪽 -하지만 코덱스에 의해 언급 된 sidenote. –

관련 문제