wordpress 4.1也更新了一阵子了,作为一般用户最关系的就是新的wordpress主题,作为开发者,新增的函数也给我们带来了更多的便捷和惊喜,今天就转载一篇介绍wordpress4.1中新增的主题函数,做个备忘。

add_theme_support( 'title-tag' )

在 WordPress 4.1 开始新增了一个名为 title-tag 的主题特性。 通过声明这个特性,主题就能知道自身并没有定义标题,WordPress 就可以安全的添加标题而无须担心会导致重复添加。

function theme_slug_setup() {
add_theme_support( 'title-tag' );
}
add_action( 'after_setup_theme', 'theme_slug_setup' );

the_archive_title() / get_the_archive_title()

WordPress 的归档种类有 N 多种,日期、分类、标签、文章形式等…… 而这个不起眼的函数却可以帮你节省不少归档模板上的逻辑处理。

 the_archive_title( '<h1 class="page-title">', '</h1>' );

the_archive_description() / get_the_archive_description()

和上一个函数类似,这个函数会返回归档的相关描述。

 
he_archive_description( '<div class="taxonomy-description">', '</div>' );

the_post_navigation() / get_the_post_navigation()

返回当前文章的前/后导航。

 
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
the_post_navigation();
endwhile; // end of the loop.

the_posts_navigation() / get_the_posts_navigation()

返回文章列表的前/后导航。

 
if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
the_posts_navigation();
else :
get_template_part( 'content', 'none' );
endif;

the_posts_pagination() / get_the_posts_pagination()

返回文章列表的分页式导航。

if ( have_posts() ) :
while ( have_posts() ) : the_post();
get_template_part( 'content', get_post_format() );
endwhile;
the_posts_pagination();
else :
get_template_part( 'content', 'none' );
endif;

WordPress4.1新的函数介绍的更多相关文章

  1. python中multiprocessing.pool函数介绍_正在拉磨_新浪博客

    python中multiprocessing.pool函数介绍_正在拉磨_新浪博客     python中multiprocessing.pool函数介绍    (2010-06-10 03:46:5 ...

  2. Odoo 二次开发教程(五)-新API的介绍与应用

    [关于odoo新API的介绍,Internet上资料很少,或者不够完整详实,这会对初学者造成很大的困惑,本篇的目的就是希望能帮助新手了解新API的大概] odoo 新api的实现是借助于python装 ...

  3. javascript 函数介绍

    javascript函数使用的时候,往往都比较单一,这里介绍几种不同于我们之前使用的函数调用方式! 1.函数表达式包含名称,用于递归 var f = function s(num) { if (num ...

  4. OVERLAPPED相关的socket函数介绍

    OVERLAPPED相关的socket函数介绍 上一篇文章介绍了<Windows核心编程>OVERLAPPED结构与内核对象IOCompletionPort相关概念,见http://www ...

  5. Linux驱动 - select函数介绍

    一.select 函数介绍 select函数用于在非阻塞中,当一个套接字或一组套接字有信号时通知你,系统提供select函数来实现多路复用输入/输出模型,原型:          #include & ...

  6. Python3的内置函数介绍

    Python3的官网链接:https://docs.python.org/3/library/functions.html?highlight=built#ascii 内置函数介绍 abs 绝对值函数 ...

  7. MySQL 常用函数介绍

    MySQL 基础篇 三范式 MySQL 军规 MySQL 配置 MySQL 用户管理和权限设置 MySQL 常用函数介绍 MySQL 字段类型介绍 MySQL 多列排序 MySQL 行转列 列转行 M ...

  8. Hive函数介绍

    一些函数不太会,查了些资料,分享一下 Hive已定义函数介绍: 1.字符串长度函数:length 语法: length(string A)返回值: int举例:[sql] view plain cop ...

  9. R数据分析:数据清洗的思路和核心函数介绍

    好多同学把统计和数据清洗搞混,直接把原始数据发给我,做个统计吧,这个时候其实很大的工作量是在数据清洗和处理上,如果数据很杂乱,清洗起来是很费工夫的,反而清洗好的数据做统计分析常常就是一行代码的事情. ...

随机推荐

  1. VARCHAR2字段关联

    SQL> create table a1(id int,name varchar2(10)); Table created. SQL> create table a2(id int,nam ...

  2. [LeetCode#271] Encode and Decode Strings

    Problem: Design an algorithm to encode a list of strings to a string. The encoded string is then sen ...

  3. 建立HttpsConnection

    1建立HttpConnection,这种连接比较简单,但是是不安全的,网上例子比较多,现在主要说说如果建立HttpsConnection,这种连接时通过SSL协议加密,相对更安全,一般使用这种连接传输 ...

  4. C# 加密解密(DES,3DES,MD5,Base64) 类

    public sealed class EncryptUtils     {         #region Base64加密解密         /// <summary>        ...

  5. Bzoj 2705: [SDOI2012]Longge的问题 欧拉函数,数论

    2705: [SDOI2012]Longge的问题 Time Limit: 3 Sec  Memory Limit: 128 MBSubmit: 1959  Solved: 1229[Submit][ ...

  6. [Java] HashMap 导致的高 CPU 使用率

    今天在生产环境遇到一个问题,Java 应用程序的 cpu 使用比例很高,导致整台机器的 cpu 使用率高达 90% ,正常情况下是 20% 左右. 把 Thread dump 导出来,利用 IBM T ...

  7. lightoj1051 Good and Bad (dp)

    题目链接:http://lightoj.com/volume_showproblem.php?problem=1051 题目大意:给你一个字符串,只包含大写字母和‘?’,如果字符串中出现了连续三个以上 ...

  8. poj 1011 搜索减枝

    题目链接:http://poj.org/problem?id=1011 #include<cstdio> #include<cstring> #include<algor ...

  9. HTTPClient实现java自动登录人人网

    参考网址: https://passport.csdn.net/account/login  http://www.iteye.com/topic/638206 httpClient http://b ...

  10. Mina学习之与Spring整合

    本章中演示在Spring中整合Mina,为了整合到Spring,需要做以下几个步骤: 1. 设置IoHandler <bean id="trapHandler" class= ...