wordpress主题(2)日志内容

在日志标题代码下面输入:

<div class="entry">

      <?php the_content();?>

</div>

the_content()函数调用了日志的内容,再输入

<p class="postmetadata">
                            <?php _e('Filed under&#58;'); ?>
                            <?php the_category(', ') ?>
                            <?php _e('by'); ?>
                             <?php  the_author(); ?><br />
                            <?php comments_popup_link('No Comments &#187;', '1 Comment &#187;', '% Comments &#187;'); ?>
                             <?php edit_post_link('Edit', ' &#124; ', ''); ?>
                        </p>

<p class="postmetadata"></p>:把日志元数据和日志内容分开。

<?php _e('Filed under:');?>:把Filed under:放入<?php _e(");?>中不是必须的,这是为了使得Filed under:可翻译,也可以直接输入Filed under:

<?php the_category(',')?> the_category()是用来调用日志所在的所有类别的PHP函数。

如果把Filed under:和the_category()放在一起,可以得到:Filed under:Name of category 1,Name of category 2,the_category()中的逗号是用来区分类别名。

<?php _e(‘by’);?> _e()是用来创建可以翻译的主题

<?php the_author();?>输出当前日志作者

<?php comments_popup_link('No Comments>>','1 Comment >>','%Comments>>');?>当弹出留言功能激活后,

comments_popup_link()调用一个谭处端留言窗口,如果没激活,就显示留言列表。No Comments是在没有留言的时候显示的。

1 Comments>>用于有1条留言的时候。

<?php edit_post_link('Edit','|',");?>管理员或者作者身份登陆的时候才可见。

它有3个参数:第一个是用来确定哪个词你将用在编辑链接的链接标题,第二个参数是用来显示在连接前面的字符,竖线|的代码就是&124

第三个是用于显示编辑链接后的字符,这里没使用。

登陆wordpress后,再返回到首页就可以看到Edit的链接和一条竖线

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值