2011-02-08 1 views
1

코드가 서버 측을 실행해야하기 때문에 PHP를 사용하여 내 wp_head(); 호출 바로 전에이 코드를 추가해야합니다. 코드를 내 wp_head();에 연결하면 작동하지 않습니다. 전에 추가해야합니다. 추가 할 PHP 코드는 다음과 같습니다. 여기브라우저에 반환되기 전에 페이지의 정확한 위치에 일부 PHP 코드를 어떻게 동적으로 추가합니까?

gravity_form_enqueue_scripts(1,true); 

코드를 삽입 할 필요가있는 것입니다 : 코드는 브라우저에 반환에 표시 안

<?php 

/* We add some JavaScript to pages with the comment form 
* to support sites with threaded comments (when in use). 
*/ 
if (is_singular() && get_option('thread_comments')) 
    wp_enqueue_script('comment-reply'); 

/* Always have wp_head() just before the closing </head> 
* tag of your theme, or you will break many plugins, which 
* generally use this hook to add elements to <head> such 
* as styles, scripts, and meta tags. 
*/ 

gravity_form_enqueue_scripts(1,true); 

wp_head(); ?> 

. 이 PHP 코드 조각을이 정확한 위치에 어떻게 동적으로 추가합니까?

add_action('wp', 'gforms_add_before_wp_head'); 

하지

add_action('wp_head', 'gforms_add_before_wp_head'); 

난 그냥에 ADD_ACTION 할 수있는 권리 훅을 발견 할 필요가 밝혀 :

+0

jQuery와 PHP를 함께 사용하여이 작업을 수행 할 수 있습니까? –

+0

어쩌면 나는 그것을 WordPress의 다른 작업에 연결해야합니까? –

답변

1

사실을 필요로했다.

관련 문제