wordpress主题(2)日志内容

来源:互联网 发布:c语言windows驱动编程 编辑:程序博客网 时间:2024/06/07 06:12

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

<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
原创粉丝点击