
1. Wordpressのdo_actionの使い方 ▶
本稿ではWordpressのdo_action関数について説明します。
説明
do_action関数を使用することで、Wordpressの既存の関数もしくは自分で定義した関数を呼び出すことができます。
一つの関数を呼び出すのではなく、関数に付与したタグを指定することでタグのついた関数を一度に呼び出すことができます。
構文
$tagに呼び出したいタグを、$argに指定した関数に与える引数を指定します。
<?php do_action( $tag, $arg ); ?> |
複数の引数を与える場合は以下のようにします。
<?php do_action( $tag, $arg_a, $arg_b, $etc ); ?> |
関数の登録とタグの付与
関数の登録の仕方とタグの付与方法を説明します。
以下、function.phpに関数を定義します。
//関数の定義 中身はなんでもいい function test_func( $a, $b )
//関数を登録する // add_action( $tag, $function_to_add, $priority, $accepted_args ); add_action( 'test_tag', 'test_func', 10, 2 );
//関数を呼び出す do_action( 'test_tag', "A", "B" );
|
人気ページ
最近更新/作成されたページ
- djangoで電卓の作成【python】 (2018-11-30 16:05:07)
- MySQLにおけるパーセンタイルの導き方 NEW! (2019-11-21 10:13:54)
- MySQLにおける階層SQL(バージョン8未満) NEW! (2019-11-21 10:06:04)
- MySQLにおける中央値(Median)の導き方(バージョン8未満) NEW! (2019-11-21 09:45:54)
- ckeditor5(Basic)の導入手順と使い方 (2018-09-30 07:36:34)
- Exception in thread "main" java.lang.UnsupportedClassVersionError: org/springframework/boot/loader/JarLauncher : Unsupported major.minor version 52.0 NEW! (2019-11-13 22:37:47)
- 【Spring】Basic認証の実装と特定のURLに限定する方法 NEW! (2019-11-13 15:41:00)
- 【Spring】ポート番号の変更 (2019-11-05 12:57:36)
- 【Linuxコマンド】開いているlsof ポート番号の確認 (2019-06-03 11:55:45)
- Spring Bootプロジェクトの実行方法 (2018-07-26 10:46:47)
最近コメントのあったページ
- テスト (2019-12-12 07:59:58)
- 【Swift】定数(let)の宣言 (2019-12-12 07:11:00)
- Spring Bootプロジェクトのビルドと本番環境へのデプロイ方法(内部tomcat使用) (2019-12-12 02:55:47)
- Spring Bootプロジェクトのビルドと本番環境へのデプロイ方法(内部tomcat使用) (2019-12-11 15:14:04)
- コメント (2019-12-11 15:03:07)
- 【Laravelエラー】Illegal offset type (2019-12-11 14:26:19)
- 【Javascriptエラー】Uncaught TypeError: location.href is not a function (2019-12-11 02:56:35)
- MySQLにおける実行計画の表示方法 (2019-12-11 02:33:01)
- 【Vue.js】ルーティング設定 (2019-12-10 20:51:10)
- Wordpressのインストール方法(CentOS + nginx) (2019-12-10 13:39:36)
最近の質問
- セレクトボックスのCSSのcontentで三角の部分が押せない (2019-07-03 13:06:10)
- GCPのwp-config.phpでpermission denied (2019-06-05 20:04:08)
- Spring FrameworkのEntityのカラム名の大文字小文字、アンスコについて (2019-02-01 07:13:49)
- PHP(Laravel)からPythonのプログラムを呼び出したいのですがどうすればよいでしょうか。 (2018-12-06 06:26:57)
- djangoを本番環境にデプロイしたいのですがどのレンタルサーバー or VPSサーバーがよいですか (2018-12-01 12:04:18)
- Django administrationのUsernameとPasswordについて (2018-11-30 11:55:20)
- Google Adsenseでアダルトコンテンツと誤認されてしまいました。 (2018-09-09 17:15:36)
- Google MapsをUnityで使用する方法&料金 (2018-08-28 02:37:26)
- Amazon PA-APIのSort=salesrankが効かない (2018-07-21 08:54:25)
- 楽観ロックと悲観ロックの違い (2018-01-11 05:05:33)
- レンタルサーバーって沢山ありますけどどこがいいでしょうか?AWSってどうなんですか? (2018-01-09 10:03:20)
- ディープラーニングのライブラリってどれがオススメですか? (2018-01-06 05:15:40)
- Webスクレイピングってどこまでが違法なんでしょうか? (2018-01-06 05:09:08)
- 人工知能(AI)、機械学習、ディープラーニングの違い (2018-01-06 02:40:44)
コメントを削除してもよろしいでしょうか?
No.8 |
guest
| 2019-10-15 10:15:15
What you really want is a laptop or tablet computer. Well this dilemma can be avoided if getting . know ways to set a spending budget for your game. Some people aspire more than things he already has. http://Tilly.Linker@Eco.S.Y.St.E.Mkaes@Alina.hu/phpinfo.php?a%5B%5D=%3Ca+href%3Dhttps%3A%2F%2Fkslot.app%2Findex.php%2Fgames%2Frollex11%3Erollex+11%3C%2Fa%3ENo.7 |
guest
| 2019-10-09 11:44:41
I have to thank you for the efforts yoou hav put in writing this website. I'm hoping to see the same high-grade content from you in thee future as well. In fact, your creative writing abilities has inspirdd me to get my own, personal blog now ;) http://tvc.in/joker123tips140319No.6 |
guest
| 2019-10-04 04:56:10
While they sang about "Detroit Rock City", KISS actually got its start in New York City. Once youu have these basics mastered, it is time to how to play bass guitar. Surely, hilarity and outrageousness would happen. http://www.wwwdr.Ess.Aleoklop.e@www.your-hoster.de/info.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Face333.gdn%2Findex.php%2Fdownload%2F1-918kiss-scr888%3E918+kiss%3C%2Fa%3ENo.5 |
guest
| 2019-10-02 13:26:55
Winning or losing merely the other side of the coin. However, these bonuses come with wagering requirement. Some websites offer the gamers with 69 types three reel slot movie. http://elesipijygho.mihanblog.com/post/comment/new/108/fromtype/postone/fid/15261067265af68a66a4f4f/atrty/1526106726/avrvy/0/key/18fb89be28237f2bdf725d6f934868e2/No.4 |
guest
| 2019-09-28 13:59:19
Methods what we do, feel and think today are going to do, feel, and think tomorrow. Here are points to allow you bring back the love. Which actions help effect the separation? https://w.anting.parentcrazyre.stfir.stdro@www.mondaymorninginspiration@fidelia.commons@Hu.Fen.Gk.Uang.Ni.U.B.I.Xn--.U.K.6.2@p.a.r.a.ju.mp.e.r.sj.a.s.s.en20.14@idiving.de/en/node/2796/trackNo.3 |
guest
| 2019-09-26 10:59:21
They win the admiration, respect, and good opinion of others, at a fast rate. You don't need turn out to be wary of attending events where they could also be. Fortunately, you can always get your banners around the web. http://Tresa.Kaye@dhavi.blog.w.skve.org/php_test.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2F918.credit%2Fcasino-games%2Fjoker-123%3Ejoker123+casino%3C%2Fa%3ENo.2 |
guest
| 2019-09-24 23:49:14
Hello, i read your blog occasionaly and i own a similar one and i was just wondering iif you gget a loot of spam feedback? If so how do you protect against it, any plugin or anything you can advise? I get so much latesly it's dricing me crazy so any assisstance is very much appreciated. http://eaccelerateconsulting.com/__media__/js/netsoltrademark.php?d=918.network%2Fcasino-games%2F70-3win8No.1 |
guest
| 2019-09-23 05:28:59
Peter Criss was "Catman"--needing tgose nine lives to distance himdelf from his rough childhood in Brooklyn. Canup got his begin in the industrdy back in 2001 being a ticket taker. Besides being innovators, KISS were also influencers. http://Tresa.Kaye@dhavi.blog.w.skve.org/php_test.php?a%5B%5D=%3Ca+href%3Dhttp%3A%2F%2Face333.gdn%2Findex.php%2Fother-games%2F918kiss%2F13-918kiss%3Escr888+download%3C%2Fa%3E