wordpress模板常用函数集锦

2019-02-19 19:07:01刘景俊

<!–p the_title();–>: 内容页(Post/Page)标题
<!–p the_permalink()–>: 内容页(Post/Page) Url
<!–p the_category(’,’)–>: 特定内容页(Post/Page)所属Category
<!–p the_author();–>: 作者
<!–p the_ID();–>: 特定内容页(Post/Page) ID
<!–p edit_post_link();–>: 如果用户已登录并具有权限,显示编辑链接
<!–p get_links_list();–>: 显示Blogroll中的链接
<!–p comments_template();–>: 调用留言/回复模板
<!–p wp_list_pages();–>: 显示Page列表
<!–p wp_list_categories();–>: 显示Categories列表
<!–p next_post_link(’%link’);–>: 下一篇文章链接
<!–p previous_post_link(’%link’);–>: 上一篇文章链接
<!–p get_calendar();–>: 日历
<!–p wp_get_archives()–>: 显示内容存档
<!–p posts_nav_link();–>: 导航,显示上一篇/下一篇文章链接
<!–p include(TEMPLATEPATH . ‘/文件名’);–>: 嵌入其他文件,可为定制的模板或其他类型文件

模板相关其他函数

<!–p _e(’Message’);–>: 输出相应信息
<!–p wp_register();–>: 显示注册链接
<!–p wp_loginout();–>: 显示登录/注销链接
<!–ext pag–>: 将当前内容分页
<!–or–>: 将当前内容截断,以不在主页/目录页显示全部内容
<!–p timer_stop(1);–>: 网页加载时间(秒)
<!–p echo get_num_queries();–>: 网页加载查询量

当然,wordpress的函数远远不止这些,如果你有更高的要求,请访问wordpress官方代码页面