当サイト、Codex 日本語版は今後積極的な更新は行わない予定です。後継となる新ユーザーマニュアルは、https://ja.wordpress.org/support/ にあります。
万が一、当サイトで重大な問題を発見した際などは、フォーラムWordSlack #docs チャンネルでお知らせください。</p>

「プラグイン API/アクションフック一覧/wp footer」の版間の差分

提供: WordPress Codex 日本語版
移動先: 案内検索
(最新版のマージ)
1行目: 1行目:
{{NeedTrans}}
 
 
 
==説明==
 
==説明==
  
The '''<tt>wp_footer</tt> action''' is triggered near the <tt></body></tt> tag of [[Theme Development#Template Files|the user's template]] by the [[Function Reference/wp_footer|<tt>wp_footer()</tt> function]]. Although this is theme-dependent, it is one of the most essential theme hooks, so it is fairly widely supported.
+
'''<tt>wp_footer</tt> アクション''' は、 triggered near the <tt></body></tt> tag of [[Theme Development#Template Files|the user's template]] by the [[関数リファレンス/wp_footer|<tt>wp_footer()</tt>関数]].  
 +
Although this is theme-dependent, it is one of the most essential theme hooks, so it is fairly widely supported.
  
 
This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn't return, and shouldn't take any parameters.
 
This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn't return, and shouldn't take any parameters.
  
This hook is theme-dependant which means that it is up to the author of each WordPress theme to include it. It may not be available on all themes, so you should take this into account when using it.
+
This hook is theme-dependent which means that it is up to the author of each WordPress theme to include it. It may not be available on all themes, so you should take this into account when using it.
 +
 
 +
When included, the default output for this function is the admin panel which will be shown in the top of the theme.
 +
It should be kept in the footer for every theme because most of the plugin bind their script files or functions to this hook.
  
 
This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this:
 
This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this:
 
<pre>
 
<pre>
 
<?php
 
<?php
 +
function your_function() {
 +
    echo '<p>This is inserted at the bottom</p>';
 +
}
 
add_action('wp_footer', 'your_function');
 
add_action('wp_footer', 'your_function');
 +
?>
 +
</pre>
  
 +
==アクションの優先度を設定する==
 +
If you want to influence the moment that your hook is executed, you can append an integer as 3rd argument to add_action:
 +
 +
<pre>
 +
<?php
 
function your_function() {
 
function your_function() {
  $content = '<p>This is inserted at the bottom</p>';
+
    echo '<p>This is inserted at the bottom</p>';
  echo $content;
+
 
}
 
}
 +
add_action('wp_footer', 'your_function', 100);
 
?>
 
?>
 
</pre>
 
</pre>
  
{{Stub}}
+
The higher the number, the lower the priority and as a result your hook will be executed further down the page.
 +
Enqueued scripts are executed at priority level 20.
  
 
== 関連資料 ==
 
== 関連資料 ==
28行目: 41行目:
 
* [[Plugin API/Action Reference]]
 
* [[Plugin API/Action Reference]]
  
{{原文|Plugin API/Action Reference/wp_footer|93057}}<!-- 15:46, 17 September 2010 bono 版 -->
+
{{原文|Plugin API/Action Reference/wp_footer|148542}}<!-- 12:49, 16 December 2014‎ Chrigu99 版 -->
  
 
[[Category:アクションフック]]
 
[[Category:アクションフック]]
  
 
[[en:Plugin API/Action Reference/wp_footer]]
 
[[en:Plugin API/Action Reference/wp_footer]]

2015年6月4日 (木) 20:12時点における版

説明

wp_footer アクション は、 triggered near the </body> tag of the user's template by the wp_footer()関数. Although this is theme-dependent, it is one of the most essential theme hooks, so it is fairly widely supported.

This hook provides no parameters. You use this hook by having your function echo output to the browser, or by having it perform background tasks. Your functions shouldn't return, and shouldn't take any parameters.

This hook is theme-dependent which means that it is up to the author of each WordPress theme to include it. It may not be available on all themes, so you should take this into account when using it.

When included, the default output for this function is the admin panel which will be shown in the top of the theme. It should be kept in the footer for every theme because most of the plugin bind their script files or functions to this hook.

This hook is an action which means that it primarily acts as an event trigger, instead of a content filter. This is a semantic difference, but it will help you to remember what this hook does if you use it like this:

<?php
function your_function() {
    echo '<p>This is inserted at the bottom</p>';
}
add_action('wp_footer', 'your_function');
?>

アクションの優先度を設定する

If you want to influence the moment that your hook is executed, you can append an integer as 3rd argument to add_action:

<?php
function your_function() {
    echo '<p>This is inserted at the bottom</p>';
}
add_action('wp_footer', 'your_function', 100);
?>

The higher the number, the lower the priority and as a result your hook will be executed further down the page. Enqueued scripts are executed at priority level 20.

関連資料

最新英語版: WordPress Codex » Plugin API/Action Reference/wp_footer最新版との差分