1

wp_head();コードはサーバー側で実行する必要があるため、PHPを使用して呼び出す直前にこのコードを追加する必要があります。コードをmyにフックしてwp_head();も機能しません。直前に追加する必要があります。追加する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スニペットをこの正確な場所に動的に追加するにはどうすればよいですか?

4

1 に答える 1

1

私は実際に必要でした:

add_action('wp', 'gforms_add_before_wp_head');

いいえ

add_action('wp_head', 'gforms_add_before_wp_head');

add_action する適切なフックを見つけるだけでよいことがわかりました。

于 2011-02-08T05:33:32.837 に答える