As we know WordPress 4.7 was released at 6th December, 2016.
In official website they listed all news and changes in the new version.
I would like to list the most important ones for developer side:
New TwentySeventeen theme: It is really really great theme for bloggers. As you see, i have already switched to this theme in my blog. It is clean, really mobile friendly, fast. And it has very beautiful fonts included. It also has custom CSS field which is very important for customizing. It is the first WordPress theme which i liked since TwentyTen.
Yet another global variable death – now we can use get_bloginfo( ‘version’ ) instead of global $wp_version variable.
REST API Content Endpoints – From version to version WordPress becomes more suitable for 3rd party app development. In latest version WordPress comes with REST API endpoints for posts, comments, terms, users, meta, and settings.
New theme API function: get_theme_file_uri(). Now we can use get_theme_file_uri (‘js/file.js’) instead of get_template_directory_uri().’js/file.js’
Page Templates for Post Types – now you can create default templates for custom post types just with adding Template Post Type: custom_post_type to the file head commented area.
Custom Bulk Action – It is also really useful feature. Before to add custom bulk action option we had to use own non-standard ways. Now it has native support.
May be the title sounds a little contradictious, as WordPress nonces are not storable data, so they don’t need to be expired. They are just hashed functions which are used for anti-CSRF purposes.
But for some special cases we may need to make nonce “to be expired”.
I mean, at first request it should work, after second request it should return false. Or it should work this day, since tomorrow it should return invalid.
This operation smells anti-bruteforce attempt, rather than anti-CSRF. Because anti-CSRF technology doesn’t have any relation with time and expiration.
So, our aim is to create a form which works only one time or temporary. This solution may be useful when we do ajax requests which should run only at once via setTimeout. So after
Let’s do that. (i write sample for ajax nonces. But same method can be used with input, url nonces too.)
Usually WooCommerce themes have their own search forms, from simple “input-submit” to advanced “input-filter1-filter2-…-checkbox1-submit” ones.
But sometimes shop owners meet a such problem: Their search form takes the visitor to WP search results page instead of WooCommerce rich search result one.
What is the difference between these two results page?
WP Search results page is simple – it shows all results (in most cases its UI has simple bloggy style, and yeah, bloggy view in WooCommerce search is not suitable UI)
WooCommerce Search Results page is more complitated – Usually it has a product category, parameter filter at sidebar, and its UI is not bloggy, it has normal grid which is important for product view.
Why does it happen? It happens only when there is missing post_type parameter in url.
When search form submit takes you to shopsite.com/?s=productname it will show you default WP search view. When search form submit takes you to shopsite.com/?s=productname&post_type=product it will show you correct UI. Normal shop search results page.
So we just need to add missing parameter to search forms, and everything will be ok.
To add this we need very simple script at the footer.
P.S. You may also want to have smart search suggestion box to the WooCommerce with this plugin.