If you’ve written a child theme for Twenty…

If you’ve written a child theme for Twenty Fifteen, please note that some of the new pagination functions have been renamed for a bit of clarity:

  • the_pagination() is now the_posts_pagination()
  • get_the_pagination() is now get_the_posts_pagination()
  • These two functions now emit a “posts-navigation” HTML class, instead of “paging-navigation”

@obenland‘s original post on new template tags in WordPress 4.1 has been updated with these changes.

#4-1, #bundled-theme, #dev-notes, #twentyfifteen

New Template Tags in 4.1

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-templatepage-template-page-templates, page-template-full-width and page-template-page-templatesfull-width-php. Worked on in #23470 and then introduced in r30100.

#4-1, #bundled-theme, #dev-notes, #themes, #twentyfifteen

Title Tags in 4.1

For over three years we have been trying to make it easier for plugins and themes to manage the document title. Kubrick didn’t necessarily set a great example to theme authors by appending the blog name to wp_title(), a practice we have been trying to correct ever since.

#18548 was created to find a solution to that problem, but after initial excitement hasn’t seen any noteworthy action until a few weeks ago. Yesterday @johnbillion committed a first step towards a brighter future in [30074], introducing a forward compatible way to make document titles fully customizable.

Adding titles to themes

Starting with 4.1 and Twenty Fifteen, the recommended way for themes to display titles is by adding theme support like this:

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

Support should be added on the after_setup_theme or init action, but no later than that. It does not accept any further arguments.

By declaring support like this, themes acknowledge that they are not defining titles on their own and WordPress can add it safely without duplication.

To maintain full forward compatibility, plugins can not check for theme support of title tags, and are discouraged from building functionality around it just yet. The long term plan is to enable users to manage document titles from their admin, independent of which theme they’re using. At that time it will also become more plugin friendly. To make sure this can be achieved however, it was important to rule out backwards compatibility concerns as much as possible.

While there is no consensus on how the final implementation will look like yet, this should be a good way to get themes started to opt into a more user friendly way. It will also make any future changes that much more impactful when the final version ships.

Backwards compatibility

To enable support in existing themes without breaking backwards compatibility, theme authors can check if the callback function exists, and add a shiv in case it does not:

if ( ! function_exists( '_wp_render_title_tag' ) ) :
	function theme_slug_render_title() {
?>
<title><?php wp_title( '|', true, 'right' ); ?></title>
<?php
	}
	add_action( 'wp_head', 'theme_slug_render_title' );
endif;

This would also be the place to optionally add a filter to enhance the document title, along the lines of what recent default themes have been doing.

#4-1, #bundled-theme, #dev-notes, #themes, #twentyfifteen

Twenty Fifteen Chat Summary October 28

Notes for our weekly chat about Twenty Fifteen:

Twenty Fifteen continues to feel pretty robust — thanks to everyone who’s been testing the theme, reporting bugs, and contributing to patches with code or comments. We’re in good shape.

The biggest change in the past week for a lot of people will have been the closing of #29979. Scrollbar is no longer a plural in Twenty Fifteen. 🙂

We’ve also had lots of great accessibility improvements.

In todays weekly chat we reviewed the remaining tickets for the theme. We’ve entered a phase of cleanup and nice-to-haves, with one remaining blocker, activation in older versions of WordPress. We’ll follow the lead of previous default themes with a back compat check.

Customizer-related tickets that could use more eyes:

#bundled-theme, #twentyfifteen

Twenty Fifteen Chat Summary October 21

Notes for our first weekly chat about Twenty Fifteen:

We started off our office hours for today precisely right on the minute — one hour early. Apologies to anyone who missed the chat time. Maybe we were too eager to chat about Twenty Fifteen.

Twenty Fifteen is in great shape right now but we still need bug finders and patch testers/contributors to help us make this the best default theme yet. Right now, our biggest priorities are mobile, accessibility, and the big ticket: double scrollbars.

Our big ticket right now, the blocker, is #29979 — the double scrollbar. The more eyes we have on this ticket the better. The goal is a fixed sidebar, only when the height is just right for it. When the height isn’t right, it should scroll with the content.

It would be great to have some help with #29980.

The accessibility team has done a great review of Twenty Fifteen. (Thanks!) Our top priority right now is to make sure we have those tickets prioritized and in trac. @davidakennedy is going to lead the charge with getting those tickets in.

@davidakennedy and @karmatosed will be continually looping the a11y and theme review teams into Twenty Fifteen testing and development.

We also chatted about Sass and determined that the discussion around shipping Sass with a default theme will be best to have ahead of, and for, Twenty Sixteen. Let’s decide to do it, if we do it, then. It doesn’t seem like it would have helped with any of the tickets so far, and even including it for development at this time is one more feature to keep track of at this point. There’s no ticket for it yet, but including it will be a wontfix.

The chat log is here. Join us weekly in IRC, Tuesdays at 15:30 UTC.

#bundled-theme, #twentyfifteen

Twenty Fifteen is in /trunk!

twenty-fifteen

With r29892 the first pass at our new default theme, Twenty Fifteen, is in core. While a lot of hard work has gone into it already it won’t be complete without your help. Check it out and do your best to twist it, bend it, and break it everywhere you can — especially on your favourite and least favourite mobile devices. Every tester, and every ticket, helps get us closer to an amazing theme for 2015.

If you’d like to help out with fixing some of those bugs in all those tickets, patches welcome. 🙂 And we’ll be going over everything Twenty Fifteen in IRC, every Tuesday at 15:30 UTC, in #wordpress-dev. Come hang out with us and squash some bugs.

#bundled-theme, #twentyfifteen

Twenty Fifteen

It’s that time of the year again, time to work on a new default theme!
This year we’re back to creating a brand new design. Like Twenty Fourteen, this is being targeted for December and thus WordPress 4.1.

@matt asked Takashi Irie to design Twenty Fifteen, and they are both closely collaborating with @iandstewart, who also worked on Twenty Ten and Twenty Eleven. The design is far from finished, but the following screenshots might give you an idea of what direction it is headed this year:

Twenty Fifteen is a clean, blog-focused theme designed through simplicity. With careful attention to typography, the theme treats text as a major part of the user interface. It features Google’s Noto Serif and Sans – a font family designed to be visually harmonious across many of the world’s languages, and a perfect fit for the internationalization strides being made in WordPress core.

The theme is also designed to maximize the impact of core’s customization tools – Custom Headers and Custom Backgrounds. These tools will allow any Twenty Fifteen blog to be easily personalized.

Last but definitely not least, Twenty Fifteen uses a mobile first approach in its design, remaining attractive and focusing on an optimal browsing experience across a wide array of devices from mobile to widescreen desktops.

All of these things come together to present content cleanly for any of Twenty Fifteen’s users – a simple default theme.

—Takashi Irie

Next steps will be to finish the design, create a working theme, commit that to core, and then break it and make sure it adheres to the high standards and expectations we all have for default themes.

If you are interested in contributing, please subscribe to this blog (if you haven’t already), and leave your name in the comments. As soon as it’s ready for public breaking, testing, and patching, I’ll make sure you get a ping!

Further reading:

#4-1, #bundled-theme, #themes, #twentyfifteen