WordPress 4.7

Exactly on time, WordPress 4.7 has been released on December 6th, 2016. This is another mile in WordPress history and this is great mile indeed.

Twenty Seventeen - new default theme

Twenty Seventeen

I bet you can recognize this naming convention 🙂 Yeah, we’ve got new default theme, Twenty Seventeen. It looks fresh, it looks good and I love it (today, anyway). It also works great.

Do I need to add anything about responsiveness? No? Just like I thought. It just is.

More – if you need to change anything or, for example, add video header? Well, then do that and don’t bother 😉 It’s easy as you read.

You can use brand new (well, let’s say this is about functionality) customizer. You may change anything you like, preview changes, change it again, preview changes… and no-one will be able to see it, except you. It means you may tune your site without any maintenance modes etc.

By the way, if you are not familiar with WordPress names, you don’t know what title or logo is (really?) you will get nice icons. And thanks to this feature, you’ll be able to see what you can change without much thinking. Thinking is good, but this is the place when you need to look and feel. Thinking is on WordPress site.

Maybe you just need to think? You know CSS and you know what to do to tune your site a bit? Well, now it’s easier than before. You may add your custom CSS code and see live preview. It’s amazing.

What about menus? Finally (I waited for this for years!) you may create pages while adding menu items. You don’t need to jump from Pages to Appearance menu on and on again. It’s easy and it’s beautiful.

There is also great feature about PDF files. In “real life” PDF files are common. Previously you need good titles to recognize files, now you still need good titles (SEO, guys, SEO!) but you may see file preview as well (as a thumbnail).

What about developers?

They thought about us, too! For the first time, we’ve got Post Type Templates. Feature known for years, but used only for pages, now is available for post types. Actions and filters “engine” has been rewritten and now is much better. And, what is more important, you may still use it old-way. So it is completely (almost) compatible with previous solution. You still use “apply_filters” or “do_action” stuff.

But I wrote “almost”. Why? Because if you modify directly $wp_filter array, then you may step into some troubles. Simply because $wp_filter is no longer simple array! Now it is object implementing ArrayAccess interface. So, instead of:

you may write:

Of course direct modifications of $wp_filter is not recommended at all.

New players: get_theme_file_uri() and get_theme_file_path()

You probably know get_template_part() functions (it is with us since WordPress 3.0). It is great for building child themes, because it looks in child theme for specified file and then falls back to parent theme directory (if there is no file in child directory of course). Now, get_theme_file_uri() – it is basically the same thing for URLs! For example:

This enqueues theme.js from child theme… if it exists! If not, it falls back to parent theme. It’s perfect.

Of course, get_theme_file_path() is file path equivalent of previous function.

Of course if parent uri/path is exactly what you need, you may also use two functions: get_parent_theme_file_uri() and get_parent_theme_file_path().

Template hierarchy filter

Another great feature. Thanks to it, you may change template hierarchy for any template page. You may see example below (it is taken from WordPress documentation):


You know register_setting() functions. Now you may include type, description and REST API visibility mark. And this is important, because REST API has been enhanced. You may use it to connect with your WordPress site and do almost anything. So, it is easier to write application to drive your WordPress site. Well, you may not need admin screen ever again.

Bulk actions

Finally, bulk actions. You may see those in list tables (with Pages for example). There are “Edit” or “Move to Trash” options. Now you are able to register your own action in this menu! It is very easy:

Now you need to handle form submission, you may do it like:

And finally show results to the user:

You need to write a few lines of code, but now you do not need to hack anything. Now it is easy.

That’s not all

Of course it isn’t everything. Stay updated with WordPress and my blog.

WordPress 4.7 is named “Vaughan” in honor of legendary jazz vocalist Sarah “Sassy” Vaughan.

I used her photo in the featured image – this work is from the William P. Gottlieb collection at the Library of Congress. According to the library, there are no known copyright restrictions on the use of this work. In accordance with the wishes of William Gottlieb, the photographs in this collection entered into the public domain on February 16, 2010, thank you!)


Leave a Reply

Your email address will not be published. Required fields are marked *