admin管理员组文章数量:1333428
So I'm getting the following error Warning: printf(): Too few arguments in /lib/helpers.php on line 34
So line 34 is 'class' => []
// Define the read more url
function read_more_url() {
// Grab the posts link and title
echo '<a href="' . esc_url(get_the_permalink()) . '" title="' . the_title_attribute(['echo' => false]) . '">';
printf(
// Filters text content and strips out disallowed HTML
wp_kses(
__('Read more <span class="u-screen-reader-text">about %s</span>', 'Sema'),
[
'span' => [
'class' => []
]
]
)
);
}
Could someone tell me what I might be doing wrong? The echo is working correctly.
So I'm getting the following error Warning: printf(): Too few arguments in /lib/helpers.php on line 34
So line 34 is 'class' => []
// Define the read more url
function read_more_url() {
// Grab the posts link and title
echo '<a href="' . esc_url(get_the_permalink()) . '" title="' . the_title_attribute(['echo' => false]) . '">';
printf(
// Filters text content and strips out disallowed HTML
wp_kses(
__('Read more <span class="u-screen-reader-text">about %s</span>', 'Sema'),
[
'span' => [
'class' => []
]
]
)
);
}
Could someone tell me what I might be doing wrong? The echo is working correctly.
Share Improve this question asked Jun 28, 2020 at 2:00 DevSemDevSem 2092 silver badges10 bronze badges1 Answer
Reset to default 1Your printf
statement awaits additional string argument which would be substituted instead of %s
:
printf(
// Filters text content and strips out disallowed HTML
wp_kses(
__('Read more <span class="u-screen-reader-text">about %s</span>', 'Sema'),
[
'span' => [
'class' => []
]
]
), "some subject"
);
This example would produce the following output:
Read more <span class="u-screen-reader-text">about some subject</span>
本文标签: theme developmentWarning printf() Too few arguments in helpersphp file
版权声明:本文标题:theme development - Warning: printf(): Too few arguments in helpers.php file 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742312733a2451200.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论