开源夏令营(8)
来源:互联网 发布:windows系统常用命令 编辑:程序博客网 时间:2024/05/22 10:08
在wordpress中,所谓模板标签一般是指一篇文章的字段,比如一篇文章的标题,内容,作者,发布日期,评论数等等.
输出模板标签一般有两种方式:the_yourtag() 和get_the_yourtag();
the_yourtag()会直接把标签内容打印到html上面;
get_the_yourtag()会把标签内容保存到一个变量中,以供稍后的使用;
通常来说,the_yourtag()==echo get_the_yourtag();
例如拿标题来举例,以下两段代码是等效的:
(代码一)
<?php the_title(); ?>
(代码二)
<?php echo get_the_title();?>###注意the_permalink()对应的是get_permalink(),没有 'the';
模板标签大全:http://codex.wordpress.org/Template_Tags
常用的模板标签:
<?php the_content(); ?> 日志内容 <?php the_title(); ?> 显示一篇日志或页面的标题 <?php the_permalink() ?> 显示一篇日志或页面的永久链接/URL地址 <?php the_category(',') ?> 显示一篇日志或页面的所属分类 <?php the_author(); ?> 显示一篇日志或页面的作者 <?php the_ID(); ?> 显示一篇日志或页面的ID <?php edit_post_link(); ?> 显示一篇日志或页面的编辑链接 <?php next_post_link('%link') ?> 下一篇日志的URL地址 <?php previous_post_link('%link') ?> 上一篇日志的URL地址
0 0
- 开源夏令营(8)
- 开源夏令营(1)
- 开源夏令营(2)
- 开源夏令营(3)
- 开源夏令营(5)
- 开源夏令营(6)
- 开源夏令营(7)
- 开源夏令营之项目汇报8
- 开源夏令营(9)总结
- 开源夏令营总结
- 开源夏令营总结
- 开源夏令营总结
- 开源夏令营总结
- 开源夏令营第一周
- 开源夏令营第二周
- 开源夏令营中期报告
- 开源夏令营中期总结
- 开源夏令营中期报告
- RocketMQ原理解析-producer 5.消息在broker落地之普通消息
- Android高版本打开网络设置界面
- RGB888和565相互转换
- 黑马程序员_iso入门基础学习_C语言day5
- hdu 1022 Train Problem I
- 开源夏令营(8)
- ofstream/ifstream 文本/二进制 方式 读入/写出 数据方法
- RocketMQ原理解析-producer 6.消息在broker落地之事物消息
- 开源夏令营(9)总结
- Common user and Local user in Oracle12c
- How To Install VNC Server On Ubuntu 14.04
- 解决:windows安装程序无法将windows配置为在此计算机的硬件上运行
- maven中央工厂设置
- 性能优化(八) - 前台程序