What’s new for Developers in WP version 4.1

Usually we keep the “What’s New in WP version x.x” posts reserved and targeted to our clients who will see what we write on Senlin Online automatically in their WordPress Dashboard using our SO Dashboard Feed Widget plugin.

The upcoming WP version 4.1 however has so many new and exciting stuff for Developers that it makes much more sense to write about them here, on WP TIPS.

Let’s have a look at the goodies WP version 4.1 has for us!

Title Tag

It must be a happy day for Joost de Valk as he opened the ticket on Trac more than 3 years ago that has set this change in motion.
In the ticket he proposed “… to output the <title> tag during the run of wp_head, based on whether the current theme has added theme_support.”

Finally his idea was picked up on and thus

Since Version 4.1, themes should use add_theme_support() in the functions.php file in order to support title tag, like so:
add_theme_support( 'title-tag' );

They also have added a way to keep backward compatibility as you will see in the Codex entry on the Title Tag. You can also read the announcement post by
Konstantin Obenland.

Archive Template Tags

Suggested already two years ago in this Trac ticket a way to simplify the way of coding up the archive.php template. Currently you need a long list of conditions to get the Archive title and – if applicable/present – the description to show.

From WP version 4.1 onwards no more complicated archive templates as we will be able to use the_archive_title() to echo the title of the archive of a category (taxonomy), tag (term), author, custom post type, post format, date (the_archive_title() to return it).
Same goes for displaying the description of the current term archive: the_archive_description() (get_the_archive_description() to return it).

Navigation Template Tags

This improvement only deals with the navigation

  • to the next and previous post (you use this on the single.php template); the_post_navigation() to display and get_the_post_navigation() to return
  • to the next and previous page of posts (your main blog page uses this); the_posts_navigation() to display and get_the_posts_navigation() to return
  • between pages of posts (when you have a Post that you have split up in different pages); the_pagination() to display and get_the_pagination() to return

Page Template Body Classes

The last improvement is certainly not the least as it is quite useful! We always find it rather cumbersome to style a specific page template by having to add the following to the CSS: page-template-page-templatesfull-width-php. Like how is that even readable? And how is this useful in any way?

Fortunately from WP version 4.1 we will see a massive improvement of this one! Not only will it be possible to simply call it by its name page-template-full-width, you will also be able to call all the page templates together with page-template.
It doesn’t stop with that either, which makes it even more flexible!
You will also be able to start using different folders for different types of page templates and style the templates of those folders differently by using page-template-folder1 and page-template-folder2.

You can read the announcement post of the last 3 improvements over at Make WordPress Core.

If you are equally excited as us about the improvements in the upcoming WP version 4.1 please let us know in the comments and share this WP Tip on your favourite social media!