zoukankan      html  css  js  c++  java
  • WordPress4.1新的函数介绍

    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;
  • 相关阅读:
    正则表达式
    [创业指南]给海归技术创业兄弟的九个忠告
    about avast
    设计模式Hibernate
    job desc
    把INT转换成2进制等
    微服务调用跟踪
    Redis 分布式锁实现
    jquery中的$.ajax()方法
    订单从ftp写入到b2b
  • 原文地址:https://www.cnblogs.com/zywf/p/5848291.html
Copyright © 2011-2022 走看看