站长百科 | 数字化技能提升教程 数字化时代生存宝典
首页
数字化百科
电子书
▼
建站程序
开发
服务器
办公软件
开发教程
▼
服务器教程
软件使用教程
运营教程
热门电子书
▼
CSS教程
WordPress教程
导航
程序频道
推广频道
网赚频道
人物频道
网站程序
网页制作
云计算
服务器
CMS
论坛
网店
虚拟主机
cPanel
网址导航
WIKI使用导航
WIKI首页
热点词条
最新资讯
网站程序
站长人物
页面分类
使用帮助
编辑测试
创建条目
网站地图
站长百科导航
站长百科
主机侦探
IDCtalk云说
跨境电商导航
WordPress啦
站长专题
网站推广
网站程序
网站赚钱
虚拟主机
cPanel
网址导航专题
云计算
微博营销
虚拟主机管理系统
开放平台
WIKI程序与应用
美国十大主机
编辑“
WordPress:Author Templates
”(章节)
人物百科
|
营销百科
|
网赚百科
|
站长工具
|
网站程序
|
域名主机
|
互联网公司
|
分类索引
跳转至:
导航
、
搜索
警告:
您没有登录。如果您做出任意编辑,您的IP地址将会公开可见。如果您
登录
或
创建
一个账户,您的编辑将归属于您的用户名,且将享受其他好处。
反垃圾检查。
不要
加入这个!
=== 设置作者信息=== The first thing you will need to do, in order to display author information on your author page, is edit your author template file(<tt>author.php</tt>, see above) so that it figures out which author is being viewed, and retrieves all the information about the author from the database (i.e. the information entered in the User administration screen of WordPress). 为了在作者网页上显示作者信息,你首先要做的是,编辑你的作者模板文件(<tt>author.php</tt>,请看上面的)这样就会了解正在查看哪个作者,并且从数据库中返回这个作者的所有信息(例如输入在WordPress用户管理界面的信息)。 This is done by setting up a variable called <tt>$curauth</tt> (Current Author). The usual way to do this isto put the following lines before [[WordPress:The Loop]] in your template file: 通过设置一个称为<tt>$curauth</tt>(当前作者)的参数,可以实现以上的操作。在模板文件[[WordPress:The Loop|The Loop]]之前,放入以下的这些命令行,能够实现操作: <pre><?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); // NOTE: 2.0 bug requires get_userdatabylogin(get_the_author_login()); else : $curauth = get_userdata(intval($author)); endif; ?></pre> <pre><?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($author_name); // NOTE: 2.0 bug requires get_userdatabylogin(get_the_author_login()); else : $curauth = get_userdata(intval($author)); endif; ?></pre> There are other ways to receive the query and assign the value of <tt>$curauth</tt>, if the above does not work for you. For example try this code which should work in both WordPress Version 1.2 and WordPress Version 1.5 and higher. 如果上述操作不能够运行,还有其它的方式,能够得到查询,为<tt>$curauth</tt>赋予参数值。李李仁,试试这个代码,这个代码能够在WordPress1.2版本,1.5版本以及更高的版本中运行。 <pre> <?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($_GET['author_name']); else : $curauth = get_userdata($_GET['author']); endif; ?> </pre> <pre> <?php if(isset($_GET['author_name'])) : $curauth = get_userdatabylogin($_GET['author_name']); else : $curauth = get_userdata($_GET['author']); endif; ?> </pre> Or this example that only works in WordPress Version 1.5 and higher: 或者这个只在WordPress1.5版本或者更高的版本中运行的例子: <pre> <?php if(get_query_var('author_name')) : $curauth = get_userdatabylogin(get_query_var('author_name')); else : $curauth = get_userdata(get_query_var('author')); endif; ?> </pre> <pre> <?php if(get_query_var('author_name')) : $curauth = get_userdatabylogin(get_query_var('author_name')); else : $curauth = get_userdata(get_query_var('author')); endif; ?> </pre> If the above fails to work for you, another option for WordPress 1.5 or above is the following: 如果上述仍然不能够使你成功地操作,还有一个关于WordPress1.5版本或者更高的版本的选项: <pre> <?php global $wp_query; $curauth = $wp_query->get_queried_object(); ?> </pre> <pre> <?php global $wp_query; $curauth = $wp_query->get_queried_object(); ?> </pre>
摘要:
请注意,您对站长百科的所有贡献都可能被其他贡献者编辑,修改或删除。如果您不希望您的文字被任意修改和再散布,请不要提交。
您同时也要向我们保证您所提交的内容是您自己所作,或得自一个不受版权保护或相似自由的来源(参阅
Wordpress-mediawiki:版权
的细节)。
未经许可,请勿提交受版权保护的作品!
取消
编辑帮助
(在新窗口中打开)