wordpress基础标签之主体模板内标签示例

Դ未知

ߣ李坦

16

2019-12-04 18:41:52

实际上,WordPress带有很多预制函数,可以轻松地获取你的网站上常用的信息。我们称这些预制函数为模板标签,它是进行WordPress开发时所必须要学习的。

那么,一些模板标签只会生成一小部分数据,比如,指向博客文章的链接。

也有许多其他模板标签可以输出不同的数据,这就需要你指定想要查找的内容:

<?php the_content(); ?>······日志内容
<?php if(have_posts()) : ?>······确认是否有日志
<?php while(have_posts()) : the_post(); ?>······如果有,则显示全部日志
<?php endwhile; ?>······结束PHP函数”while”
<?php endif; ?>······结束PHP函数”if”
<?php get_header(); ?>······header.php文件的内容
<?php get_sidebar(); ?>······sidebar.php文件的内容
<?php get_footer(); ?>······footer.php文件的内容
<?php the_time(‘m-d-y’) ?>······显示格式为”02-19-08″的日期
<?php comments_popup_link(); ?>······显示一篇日志的留言链接
<?php the_title(); ?>······显示一篇日志或页面的标题
<?php the_permalink() ?>······显示一篇日志或页面的永久链接/URL地址
<?php the_category(‘, ‘) ?>······显示一篇日志或页面的所属分类
<?php the_author(); ?>······显示一篇日志或页面的作者
<?php the_ID(); ?>······显示一篇日志或页面的ID
<?php edit_post_link(); ?>······显示一篇日志或页面的编辑链接
<?php get_links_list(); ?>······显示Blogroll中的链接
<?php comments_template(); ?>······comments.php文件的内容
<?php wp_list_pages(); ?>······显示一份博客的页面列表
<?php wp_list_cats(); ?>······显示一份博客的页面列表

佭ϴý Ѷ Media8ý

在线客服

外链咨询

扫码加我微信

微信:juxia_com

返回顶部