Working on a new default theme is always an opportunity to improve core’s Theme APIs too. With the release of Twenty Fifteen there are quite a few improvements that made it in:
Archive Template Tags
Theme authors get to use four new functions to use in their archive templates:
get_the_archive_title()
and the_archive_title()
for returning/displaying the title of the current term, date, post type, post format, or author archive.
get_the_archive_description()
and the_archive_description()
for returning/displaying the description associated with the current term archive.
They are especially handy when a theme doesn’t have dedicated templates for taxonomy or date archives, but can essentially be used in all archive templates. The description functions only display term descriptions, since no other archive type really offers descriptions.
Worked on in #21995 and then introduced in r30223.
Navigation Template Tags
Core has provided template tags for links between posts and pages of posts for a long time. Now theme authors can resort to higher-level template tags to display an entire navigation snippet. If you’ve built your themes off of recent default themes, or created child themes from them, these should look very familiar. As a heads up: Since default themes have been developed in HTML5 for five years now, there is no HTML4 version of these tags.
get_the_post_navigation()
and the_post_navigation()
for navigation to the next and previous post.
get_the_posts_navigation()
and the_posts_navigation()
for navigation to the next and previous page of posts.
get_the_posts_pagination()
and the_posts_pagination()
for paginated navigation between pages of posts. (Updated for 4.1 RC1, see this post)
All functions use the same wrapping markup with semantic class names, so it’s easy to style them in one go. The navigation functions accept custom link texts and screen-reader-texts, in case the defaults are not applicable. The pagination functions even accept all arguments that paginate_links()
does, too! (Except for the 'type'
argument, we need that to be plain so the template tag doesn’t break
)
Worked on in #29808, introduced in r30065, improved in r30457.
Also in 4.1:
Theme Support for Title Tags
I’ve written about title tags before and will refer to that post for more information about the groundbreaking changes that happened here.
Page Template Body Classes
They got a minor update that simplifies those class names and allows theme authors to target folders of page templates. With this /page-templates/full-width.php
will produce page-template
, page-template-page-templates
, page-template-full-width
and page-template-page-templatesfull-width-php
. Worked on in #23470 and then introduced in r30100.
Tomas Mackevicius 8:31 pm on December 16, 2014 Permalink | Log in to Reply
I would like to inform that current Automated Theme Scanner doesn’t let to submit theme written for WP4.1. I get errors:
Results of Automated Theme Scanning: Fail
REQUIRED: The theme needs to have a call to wp_title(), ideally in the header.php file.
REQUIRED: The theme needs to have
REQUIRED: The theme doesn’t have post pagination code in it. Use posts_nav_link() or paginate_links() or next_posts_link() and previous_posts_link() to add post pagination.
Tomas Mackevicius 8:32 pm on December 16, 2014 Permalink | Log in to Reply
Will try to put as a code:
` REQUIRED: The theme needs to have a call to wp_title(), ideally in the header.php file.
REQUIRED: The theme needs to have
REQUIRED: The theme doesn’t have post pagination code in it. Use posts_nav_link() or paginate_links() or next_posts_link() and previous_posts_link() to add post pagination.`
Tomas Mackevicius 8:33 pm on December 16, 2014 Permalink | Log in to Reply
For some reason I cannot post full error here, so here we go:
http://pastebin.com/HQHDVS1f
Tomas Mackevicius 8:48 pm on December 16, 2014 Permalink | Log in to Reply
Ticket: https://core.trac.wordpress.org/ticket/30734
Ipstenu (Mika Epstein) 10:25 pm on December 16, 2014 Permalink | Log in to Reply
https://github.com/Otto42/theme-check/issues/10
This isn’t the right place to report that anyway
we got it sorted though