您现在的位置是:首页 > cms教程 > WordPress教程WordPress教程
WordPress主题开发常用数据调用介绍
访蕊2025-03-18 18:15:22WordPress教程已有5人查阅
导读记录在开发过程中常用的引入标签:在一个模板文件里引用另外一个文件comments_popup_link() ----评论条数
记录在开发过程中常用的
引入标签:在一个模板文件里引用另外一个文件
get_header()
get_footer()
get_sidebar()
get_template_part()
get_search_form()
comments_template() ----引入评论框 模版标签:
bloginfo()
wp_title()
the_title()
the_permalink()
the_content()
the_excerpt()
the_category()
the_tags()
the_time()
comments_popup_link() ----评论条数
edit_post_link()
next_post_link()
previous_post_link()
bloginfo() 显示博客信息,用法: 参数: 用途:通常用在页面头部的<title>元素中,在不同文件里,返回的值不一样,具体如下:
文章页->文章标题
日期页->日期
分类页->分类标题
作者页->作者名字
用法: 参数说明:$before 标题前,$after标题后, $echo是否直接输出
用途:需放主循环内,调用发布信息的标题,在不同文件里,返回的值不一样。 用途:调用当前信息的网址,必须在主循环内使用
<?php the_permalink(); ?>
the_content()
用途:显示内容,
如果文章插入了more标签
<?php the_content( 'Read more ...' ); ?>
有参数的情况下:
the_excerpt()
用途:调用摘要,如果没有填写摘要则截取文章前55个字符
<?php the_excerpt(); ?>
the_category()
用途:调用当前文章所属分类,必须在主循环内使用
<?php the_category( $separator, $parents, $post_id ); ?>
参数说明:$separator--分隔符,$parents---父目录控制,$post_id---文章编号
只输出当前文章目录:
<?php the_category(); ?>
去格式化输出当前文章目录:
<?php the_category('|'); ?>
子目录和父目录一起调出:
<?php the_category('|','multiple'); ?>
the_tags()
用途:调用当前分类所用的标签
<?php the_tags( $before, $sep, $after ); ?>
参数说明:$before---标签前,$sep--分隔符,$after---标签后
the_time()
用途:调用发表时间,*需放在主循环内
<?php the_time( $d ); ?>
参数说明:$d---时间显示格式
<?php the_time('Y-m-d h:i'); ?>
输出:2017-01-28 12:09
comments_popup_link()
用途:调用评论条数,并带跳转到该文章的评论框的链接,必须在主循环内使用
<?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>
参数说明:$zero--没评论的时候显示什么,$one---一条评论的时候显示什么,$more---更多评论的时候显示什么,$css_class---链接的css类,$none---文章不允许评论时显示什么
edit_post_link()
用途:有权限编辑文章时显示的编辑链接,必须在主循环内使用
<?php edit_post_link( $link, $before, $after, $id, $class ); ?>
参数说明:$link---链接文本,$before---链接文本前的文本,$after---链接文本后的文本,$id---文章ID,$class---链接样式
next_post_link(),previous_post_link()
用途:必须在主循环内使用 更多请参考文档,推荐英文版
wordpress函数参考:
英文官方参考网页:http://codex.wordpress.org/Function_Reference/
中文官方参考网页:http://codex.wordpress.org.cn/%E5%87%BD%E6%95%B0%E5%8F%82%E8%80%83
wordpress模版标签:
英文官方参考网页:http://codex.wordpress.org/Template_Tags/
中文官方参考网页:http://codex.wordpress.org.cn/%E6%A8%A1%E6%9D%BF%E6%A0%87%E7%AD%BE
wordpress引入标签:
英文官方参考网页:http://codex.wordpress.org/Include_Tags
中文官方参考网页:http://codex.wordpress.org.cn/Include_Tags
wordpress条件标签:
英文官方参考网页:http://codex.wordpress.org/Conditional_Tags
中文官方参考网页:http://codex.wordpress.org.cn/%E6%9D%A1%E4%BB%B6%E6%A0%87%E7%AD%BE
引入标签:在一个模板文件里引用另外一个文件
get_header()
get_footer()
get_sidebar()
get_template_part()
get_search_form()
comments_template() ----引入评论框 模版标签:
bloginfo()
wp_title()
the_title()
the_permalink()
the_content()
the_excerpt()
the_category()
the_tags()
the_time()
comments_popup_link() ----评论条数
edit_post_link()
next_post_link()
previous_post_link()
bloginfo() 显示博客信息,用法: 参数: 用途:通常用在页面头部的<title>元素中,在不同文件里,返回的值不一样,具体如下:
文章页->文章标题
日期页->日期
分类页->分类标题
作者页->作者名字
用法: 参数说明:$before 标题前,$after标题后, $echo是否直接输出
用途:需放主循环内,调用发布信息的标题,在不同文件里,返回的值不一样。 用途:调用当前信息的网址,必须在主循环内使用
<?php the_permalink(); ?>
the_content()
用途:显示内容,
如果文章插入了more标签
<?php the_content( 'Read more ...' ); ?>
有参数的情况下:
the_excerpt()
用途:调用摘要,如果没有填写摘要则截取文章前55个字符
<?php the_excerpt(); ?>
the_category()
用途:调用当前文章所属分类,必须在主循环内使用
<?php the_category( $separator, $parents, $post_id ); ?>
参数说明:$separator--分隔符,$parents---父目录控制,$post_id---文章编号
只输出当前文章目录:
<?php the_category(); ?>
去格式化输出当前文章目录:
<?php the_category('|'); ?>
子目录和父目录一起调出:
<?php the_category('|','multiple'); ?>
the_tags()
用途:调用当前分类所用的标签
<?php the_tags( $before, $sep, $after ); ?>
参数说明:$before---标签前,$sep--分隔符,$after---标签后
the_time()
用途:调用发表时间,*需放在主循环内
<?php the_time( $d ); ?>
参数说明:$d---时间显示格式
<?php the_time('Y-m-d h:i'); ?>
输出:2017-01-28 12:09
comments_popup_link()
用途:调用评论条数,并带跳转到该文章的评论框的链接,必须在主循环内使用
<?php comments_popup_link( $zero, $one, $more, $css_class, $none ); ?>
参数说明:$zero--没评论的时候显示什么,$one---一条评论的时候显示什么,$more---更多评论的时候显示什么,$css_class---链接的css类,$none---文章不允许评论时显示什么
edit_post_link()
用途:有权限编辑文章时显示的编辑链接,必须在主循环内使用
<?php edit_post_link( $link, $before, $after, $id, $class ); ?>
参数说明:$link---链接文本,$before---链接文本前的文本,$after---链接文本后的文本,$id---文章ID,$class---链接样式
next_post_link(),previous_post_link()
用途:必须在主循环内使用 更多请参考文档,推荐英文版
wordpress函数参考:
英文官方参考网页:http://codex.wordpress.org/Function_Reference/
中文官方参考网页:http://codex.wordpress.org.cn/%E5%87%BD%E6%95%B0%E5%8F%82%E8%80%83
wordpress模版标签:
英文官方参考网页:http://codex.wordpress.org/Template_Tags/
中文官方参考网页:http://codex.wordpress.org.cn/%E6%A8%A1%E6%9D%BF%E6%A0%87%E7%AD%BE
wordpress引入标签:
英文官方参考网页:http://codex.wordpress.org/Include_Tags
中文官方参考网页:http://codex.wordpress.org.cn/Include_Tags
wordpress条件标签:
英文官方参考网页:http://codex.wordpress.org/Conditional_Tags
中文官方参考网页:http://codex.wordpress.org.cn/%E6%9D%A1%E4%BB%B6%E6%A0%87%E7%AD%BE
本文标签:
很赞哦! (0)
暂无内容 |
暂无内容 |
相关文章
暂无内容 |
暂无内容 |
随机图文
wordpress设置定时发布文章的方法
wordpress如何设置定时发布文章,在发布文章的界面右边的【发布】选项,点击一下[立即发布]右边的“编辑”,就会出现下图所示的界面,可以选择发布日期和时间wordpress开启多用户/多站点/多域名模式
刷新网站后台,访问 工具 > 配置网络,根据自己的需要选择“子域名”或者“子目录”模式,设置好网站信息,然后点击“安装”WordPress制作主题导航菜单的方法二
上一篇教程讲了如何使用WordPress内置的函数来创建导航菜单,但是这些函数生成的HTML代码都是固定的,你很难去定义导航菜单的HTML代码。腾讯云搭建WordPress网站的方法
笔者一直很羡慕那些搭建了个人博客的大牛,在最近工作之余也尝试着搭建了自己的博客,历时1周,这篇文章就将踩过的坑记录下来,先看下成果,链接在此1- 购买腾讯云主机腾讯云官网,我
留言与评论 (共有 0 条评论) |