[手册]WordPress之使用模板标签
什么是模板标签?模版标签是用来命令WordPress进行工作的代码。4-Login/Logout tags 登录/登出 标签
- is_user_logged_in <?php if ( is_user_logged_in() ) { ... }; ?>
- 判断是否已登录.
- wp_login_form<?php wp_login_form($args); ?>
- 输出登录的表单,$args变量参见 http://codex.wordpress.org/Template_Tags/wp_login_form(3.0 的新标签?)
- wp_login_url <?php echo wp_login_url($redirect); ?>
- 返回登录的链接,并且返回到$redirect
- wp_loginout <?php wp_loginout($redirect); ?>
- 输出登出的链接,并且返回到$redirect
- wp_logout <?php wp_logout(); ?>
- 输出登出的链接(有问题?)
- wp_logout_url <?php echo wp_logout_url($redirect); ?>
- 返回登出的链接,并且返回到$redirect
- wp_lostpassword_url <?php wp_lostpassword_url($redirect); ?>
- 返回找回密码的链接,并且返回到$redirect
- wp_register <?php wp_register( $before, $after ); ?>
- 输出注册和网站管理的列表
- wp_registration_url <?php wp_registration_url($redirect); ?>
- 返回注册的链接,并且返回到$redirect(3.0的新标签?)
5-Post tags 文章信息标签
- body_class <?php body_class( $class ); ?>
- 针对不同的页面输出class.
- next_image_link <?php next_image_link( $size, $text ); ?>
- 输出当前文章的下一张图片的链接。
- next_post_link <?php next_post_link('format', 'link', 'in_same_cat', 'excluded_categories'); ?>
- 输出下一篇文章的链接,'format'用来格式化标签,范例:‘<strong>%link</strong>’,'link'是链接的名称,'in_same_cat'判断是否同分类,'excluded_categories'是排除的分类。
- next_posts_link <?php next_posts_link( $label , $max_pages ); ?>
- 显示下一页的链接,$label是链接名,$max_pages是大于多少页才显示,默认0.
- post_class <?php post_class(); ?>
- 针对不同的文章输出class.
- post_password_required <?php post_password_required(); ?>
- 要求密码才能发表?(3.0 的新标签?)
- posts_nav_link <?php posts_nav_link('sep','prelabel','nxtlabel'); ?>
- 输出导航的链接,可以使用图片,详情见http://codex.wordpress.org/Template_Tags/posts_nav_link
- previous_image_link <?php previous_image_link( $size, $text ); ?>
- 输出当前文章上一张图片的链接,详情见http://codex.wordpress.org/Template_Tags/previous_image_link
- previous_post_link <?php previous_post_link($format, $link, $in_same_cat = false, $excluded_categories = ''); ?>
- 输出上一篇文章的链接,'format'用来格式化标签,范 例:‘<strong>%link</strong>’,'link'是链接的名称,'in_same_cat'判断是否同分 类,'excluded_categories'是排除的分类。
- previous_posts_link <?php previous_posts_link( $label , $max_pages ); ?>
- 显示上一页的链接,$label是链接名,$max_pages是大于多少页才显示,默认0.
- single_post_title <?php single_post_title( $prefix, $display ); ?>
- 输出当前但文章的标题,$prefix是前缀,如:'当前文章:', $display为flase的时候,不输出,只返回该值.
- sticky_class <?php sticky_class(); ?>
- 输出置顶文章的class,必须在循环中.
- the_category <?php the_category( $separator, $parents, $post_id ); ?>
- 输出当前文章所属的分类,$separator是分隔符,$parents值为'single'时显示父分类,默认不显示,$post_id为获取指定id的文章的分类名
- the_category_rss <?php the_category_rss( $type ) ?>
- 用来显示循环中分类的链接用于rss使用。
- the_content <?php the_content( $more_link_text, $strip_teaser, $more_file ); ?>
- 输出文章的全部内容,$more_link_text是'更多'的链接名,详情见:http://codex.wordpress.org/Template_Tags/the_content
- the_content_rss <?php the_content_rss('more_link_text', strip_teaser, 'more_file', cut, encode_html); ?>
- 用于rss中的内容,详情见:http://codex.wordpress.org/Template_Tags/the_content_rss
- the_excerpt <?php the_excerpt(); ?>
- 输出摘要,即去除所有标签的完整内容.
- the_excerpt_rss <?php the_excerpt_rss( $cut, $encode_html ); ?>
- 输出用于rss中的摘要。
- the_ID <?php the_ID(); ?>
- 输出当前文章的ID
- the_meta <?php the_meta(); ?>
- ...
- the_shortlink <?php the_shortlink( $text, $title, $before, $after ); ?>
- 输出短链接,详情见:http://codex.wordpress.org/Template_Tags/the_shortlink(3.0的新标签?)
- the_tags <?php the_tags( $before, $separator, $after ); ?>
- 输出该文章的标签.
- the_title <?php the_title( $before, $after, $display ); ?>
- 输出该文章的标题.$display为false的时候,不输出,只返回标题。
- the_title_attribute <?php the_title_attribute( $args ); ?>
- 返回标题的属性,详情见:http://codex.wordpress.org/Template_Tags/the_title_attribute
- the_title_rss <?php the_title_rss(); ?>
- 为rss格式化当前文章的标题。
- wp_link_pages <?php wp_link_pages( $args ); ?>
- 显示当前文章的分页。
相关文章
本视频将以实例的形式给大家展示如何在QQWorld收藏家的采集规则里使用人工智能过滤器,就像编程一样好玩。2025年03月4日 QQWorld收藏家已经很久没更新了,以至于有的用户怀疑是不是要挂掉了,借此新版发布机会澄清一下,不可能,绝对不可能!2025年02月3日 有小伙伴建议我开发GitHub仓库作为云存储,据说有200GB流量,配合CDN就更加可观了。这么免费可控的云存储,你不想试试吗?2022年02月26日 最适合WordPress的静态缓存,免费而高效,本教程将教大家在宝塔面板上开启该缓存为WordPress提速,从此百度也会爱上你的网站哦。2022年01月8日 从去年开始,很多用户就要求开发OneDrive的云存储功能,因为容量大,便宜甚至免费。现在QQWorld收藏家豪华版终于支持了。2021年09月12日 很多用户不了解申请免费代写规则是如何运作的,于是我在百忙之中录制了该视频教程,希望对大家有所帮助。2021年06月4日 因为WordPress采集插件《QQWorld收藏家豪华版》的采集规则设置较为复杂,很多用户希望能看到适配主题的视频教程,于是我在百忙之中录制了该视频教程,希望对大家有所帮助。2021年06月2日 兰空图床(Lsky Pro)是一款优秀的开源图床程序,界面简洁功能强大,本教程将教大家安装此图床程序,并使用QQWorld收藏家将自己搭建的图床作为云存储保存媒体库里的图片附件。2020年11月19日