get_archives_linkフィルターで定義した仮引数はどのような実引数を入力すればよろしいでしょうか?
-
いつもお世話になっております。
以下のget_archives_linkフィルターについてご存知の方がいらっしゃいましたらご教示願います。—
【質問の主旨】
get_archives_linkフィルターを使って関数を作成するときの6つの仮引数は、sidebar.phpなど表示を担当する
ファイルにおいて、どうやって実引数を入力すれば良いのでしょうか?【質問の補足】
1.
今回の質問は下記のトピックの続きです。コメントをいただいたにも関わらず、私がうっかり見落として返答するのに日にちが経過しましたので、新しいトピックを立てました。
https://goo.gl/ywfX7L2.
上記のURLでも最後のコメントで同じ質問をしておりますが、具体的には以下のとおりです。functions.phpにおいてfunction my_archive_link( $link_html, $url, $text, $format, $before, $after){ $after = str_replace( array('(',')'),'', $after ); $link_html = '<li> <a href="%1$s" class="rd-archive-link"> <span class="rd-archive-date">%2$s</span> <span class="rd-archive-count"> %3$s</span> </a> </li>'; return sprintf($format, $link_html, $url,$text, $after ); } add_filter( 'get_archives_link','my_archive_link', 10, 6 );
と定義して、
sidebar.phpで
<?php my_archive_link(); ?>
とすると、
Warning: Missing argument 1 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Warning: Missing argument 2 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Warning: Missing argument 3 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Warning: Missing argument 4 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Warning: Missing argument 5 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Warning: Missing argument 6 for my_archive_link(), called in /var/www/e-yota/wp-content/themes/mytheme/sidebar.php on line 120 and defined in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 191 Notice: Undefined variable: after in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 193 Notice: Undefined variable: format in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 202 Notice: Undefined variable: url in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 202 Notice: Undefined variable: text in /var/www/e-yota/wp-content/themes/mytheme/functions.php on line 202
というエラーが出ます。いずれも実引数の定義がないと指摘されていると思いますが、<?php my_archive_link(); ?>でどんな実引数を入力すれば良いのか分かりません。
3.
今回の質問は個人で運営しているブログに関する質問で、現在は応急的に、wp_get_archives()を使用しています。4.
今回の質問に関するコードは、全てGitHub上にUPしています。
https://github.com/echizenyayota/e-yota/tree/personal_lesson_20171012—
以上、よろしくお願い申し上げます。
ヘルプの必要なページ: [リンクを見るにはログイン]
- トピック「get_archives_linkフィルターで定義した仮引数はどのような実引数を入力すればよろしいでしょうか?」には新たに返信することはできません。