archdexls主题游戏页面game-play.php有评论时,报错( ! ) Warning: printf(): Too few arguments in D:\wamp\www\wp-content\themes\arcadexls\games-play.php on line 97

( ! ) Warning: printf(): Too few arguments in D:\wamp\www\wp-content\themes\arcadexls\games-play.php on line 97
Call Stack
#    Time    Memory    Function    Location
1    0.0000    241656    {main}( )    ..\index.php:0
2    0.0000    244696    require( ‘D:\wamp\www\wp-blog-header.php‘ )    ..\index.php:17
3    0.5254    33285248    require_once( ‘D:\wamp\www\wp-includes\template-loader.php‘ )    ..\wp-blog-header.php:16
4    0.5254    33285336    do_action( )    ..\template-loader.php:12
5    0.5313    33304000    call_user_func_array:{D:\wamp\www\wp-includes\plugin.php:496} ( )    ..\plugin.php:496
6    0.5313    33304080    arcadexls_play_template_redirect( )    ..\plugin.php:496
7    0.5313    33304272    get_template_part( )    ..\template_redirect.php:118
8    0.5313    33305136    locate_template( )    ..\general-template.php:171
9    0.5313    33305320    load_template( )    ..\template.php:477
10    0.5313    33322456    require( ‘D:\wamp\www\wp-content\themes\arcadexls\single-play.php‘ )    ..\template.php:503
11    0.7578    34129056    get_template_part( )    ..\single-play.php:8
12    0.7578    34129760    locate_template( )    ..\general-template.php:171
13    0.7578    34129880    load_template( )    ..\template.php:477
14    0.7578    34196248    require( ‘D:\wamp\www\wp-content\themes\arcadexls\games-play.php‘ )    ..\template.php:503
15    0.8018    34206848    printf ( )    ..\games-play.php:97

第97行代码

            <span class="iconb-date"><?php _e(‘Uploaded on:‘, MYAPB_THEMENAME); ?> <strong><?php echo get_the_date(‘d‘); ?> <?php echo get_the_date(‘M‘); ?> , <?php echo get_the_date(‘Y‘); ?></strong></span> <span class="iconb-user"><?php _e(‘Uploader:‘, MYAPB_THEMENAME); ?> <a href="<?php echo get_author_posts_url($post->post_author); ?>"><?php the_author_meta(‘display_name‘,$post->post_author); ?></a></span> <span class="iconb-cate"><?php _e(‘Categories:‘, MYAPB_THEMENAME); ?> <?php echo get_the_category_list(‘, ‘); ?></span> <span class="iconb-comt"><?php printf( _n( ‘Comments: <strong>%2$s</strong>‘, ‘Comments: <strong>%1$s</strong>‘, get_comments_number(), MYAPB_THEMENAME),number_format_i18n( get_comments_number() )); ?></span> <?php echo get_the_tag_list(‘<span class="iconb-tags">‘.__(‘Tags:‘, MYAPB_THEMENAME).‘ ‘, ‘, ‘,‘</span>‘); ?>

其中显示评论及其条数的代码

<?php printf( _n( ‘Comments: <strong>%2$s</strong>‘, ‘Comments: <strong>%1$s</strong>‘, get_comments_number(), MYAPB_THEMENAME),number_format_i18n( get_comments_number() )); ?>

不是太懂,稍微查了一下,“如果 % 符号多于 arg 参数,则您必须使用占位符。占位符被插入 % 符号之后,由数字和 "\$" 组成。”

其中的"%1$s"和"%2$s"说占位符吧,少了\;说不是占位符吧,多了数字和$;搞不懂这里_n是做什么用的,也是一个函数,而且要四个参数?

<?php echo MYAPB_THEMENAME ?>的结果是arcadexls

<?php echo get_comments_number() ?>的结果是1

<?php echo _n( ‘Comments: <strong>%2$s</strong>‘, ‘Comments: <strong>%1$s</strong>‘, get_comments_number(), MYAPB_THEMENAME) ?>的结果是Comments: %2$s

<?php echo number_format_i18n( get_comments_number() ) ?>的结果是1

故最后printf()方法的实际调用为printf("%2$s", 1);  很明显这个应该是有问题的

将代码中的1$和2$都去掉,改为

<?php printf( _n( ‘Comments: <strong>%s</strong>‘, ‘Comments: <strong>%s</strong>‘, get_comments_number(), MYAPB_THEMENAME),number_format_i18n( get_comments_number() )); ?>

OK,至少可以解决眼下问题,虽然没完全弄明白!

时间: 2024-08-03 18:19:52

archdexls主题游戏页面game-play.php有评论时,报错( ! ) Warning: printf(): Too few arguments in D:\wamp\www\wp-content\themes\arcadexls\games-play.php on line 97的相关文章

[转]html页面调用js文件里的函数报错onclick is not defined处理方法

原文地址:http://blog.csdn.net/ywl570717586/article/details/53130863 今天处理html标签里的onclick功能的时候总是报错:Uncaught ReferenceError: dosave is not defined(-) 找了半天都没发现错在哪,最后发现原来是我写法不对,正确写法如下: html: [html] view plain copy <input type="button" value="立即登录

archdexls主题设置每页显示游戏数目

archdexls主题,沒调整前,每页显示10个,这显然不够,尤其在搜狗浏览器上,由于这个主题只有触发下拉滚动条,才会自动在同一页面显示下一页,因此只显示10个甚至不能触发显示下一页这个动作. 原来设置每页显示条数并不是在主题设置中,而是在仪表盘->设置中有一个选项: Blog pages show at most XX posts XX默认为10,这里调整为30即可

DataTables学习:从最基本的入门静态页面,使用ajax调用Json本地数据源实现前端开发深入学习,根据后台数据接口替换掉本地的json本地数据,以及报错的处理地方,8个例子(显示行附加信息,回调使用api,动态显示和隐藏列...),详细教程

一.DataTables  个人觉得学习一门新的插件或者技术时候,官方文档是最根本的,入门最快的地方,但是有时候看完官方文档,一步步的动手写例子,总会出现各种莫名其妙的错误,需要我们很好的进行研究出错的地方. 官方网站(中文):http://datatables.club/ 官方网站:https://www.datatables.net/  二.简单的例子 怎样简单地使用DataTables?使用下方简单的几行代码,一个方法初始化table. $(document).ready(function

2016/3/30 租房子 ①建立租房子的增、删、改php页面 ②多条件查询 ③全选时 各部分全选中 任意checkbox不选中 全选checkbox不选中

字符串的另一种写法:<<<AAAA; 后两个AA回车要求定格  不然报错 例子: 1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <title>Document</title> 6 </head> 7 <body> 8 <?php 9 $str = &

wampserver -- 取消PHP页面Warning和Notice级别的报错

Learn from:http://yige.org/p/91 一般遇到这样的问题,有两个方法:1.如果有服务器权限,直接把服务器上的php.ini的配置改了,改成不输出Warning和Notice级别的报错.修改php.ini的error_reporting 配置参数值为: error_reporting = E_ALL & ~E_NOTICE 当然,改完php.ini是需要重启web服务器配置才可以生效的. 2.如果没有服务器权限,在出问题的php文件头部里入下面的代码(在其他位置也可以,只

jsp页面中onsubmit=&quot;return checklogin();&quot;报错解决办法

选择Window->Preferences->MyEclipse->Validation 去掉方框里的对号,然后Apply 然后点击Yes->然后再点击ok->Yes,就好了,如果你打开了那个出现错误jsp页面的话,请关掉重现打开就ok啦 jsp页面中onsubmit="return checklogin();"报错解决办法,布布扣,bubuko.com

关于时间的操作(JavaScript版)——页面显示格式:年月日 上午下午 时分秒 星期

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-

查找页面报错(一)

查找页面报错 错误 101 (net::ERR_CONNECTION_RESET):连接已重置. 查找页面报错(一),布布扣,bubuko.com

IDEA在jsp页面写Java代码报错

如题,我以前用myeclipse,eclipse的时候,在jsp里写Java代码都是可以的,现在我换成了IDEA,却莫名报错 而且没有代码提示,比如说下图这样的,,虽然运行还是能运行...但对强迫症而言,实在不能忍 之前一直以为是idea对这种写法不太支持(毕竟都mvc思想了,在jsp里写java是有点那啥...),直到今天用idea写servlet类也报错..才去找了找,发现原来是可以配置的,tomcat的架包依赖没有导入 然后就ok了 不行的话 重启一下idea就可以 现在你可以用idea在