PressTigers

WordPress 4.4 – Insights about New Features

WordPress 4.4 is the following significant release of WordPress and is turning out to be an astounding release. It is expected to be released in the second week of December with numerous exciting features. While you have likely found a hefty portion of the changes from testing your plugins, themes and websites, this post highlights a percentage of the exciting changes WordPress engineers can anticipate.

Twenty Sixteen Theme:

This theme contains an old style sidebar and content area blog/web journal composed design with boundless color schemes. It additionally contains custom headers, two default navigation, main navigation and social links.

Responsive Images:

WordPress automatically crops image size when uploaded in media. It crops images in full size, large size, medium size and thumbnail. You can also crop custom image size by using the following function:

In WordPress 4.4, “srcset” and “sizes” attributes are used for responsive images. It will automatically display the image according to device width. By adding the image size to scrset attribute, browsers will select the best suitable image size according to the device resolution:

To execute this feature, the following new functions have been added to WordPress:

  • wp_get_attachment_image_srcset() – Recovers the value for an image attachment’s srcset characteristic
  • wp_calculate_image_srcset() – A helper function to figure out image sources to incorporate into a srcset attribute
  • wp_get_attachment_image_sizes() – Makes a sizes attribute value for a picture
  • wp_calculate_image_sizes() – A helper function to make a sizes attribute for an image
  • wp_make_content_images_responsive() – Filters img components in post content to include srcset and sizes characteristics
  • wp_image_add_srcset_and_sizes() – Adds srcset and sizes attributes to a current img component and is utilized by wp_make_content_images_responsive()

Here is an illustration of how you could use this function to manufacture an element with a custom sizes attribute:

Embeds Feature:

WordPress 4.4 has now become oEmbed provider permitting oEmbed consumer to embed content from different websites. By utilizing pretty permalinks, any post can be embedded. Here are the four most valuable functions identified with embeds:

  1. get_post_embed_url() — Recovers the URL to embed a particular post in an iframe, for example:
    https://make.wordpress.org/core/2015/10/28/new-embeds-feature-in-wordpress-4-4/embed/
  2. get_post_embed_html() — Recovers the full embed code for a particular post
  3. get_oembed_endpoint_url() — Recovers the oEmbed endpoint URL for a given permalink, for example:
    https://make.wordpress.org/core/?oembed=true&url=<url>
    This is utilized to add the oEmbed disclosure connections to the HTML for single posts
  4. get_oembed_response_data() — Recovers the oEmbed response information for a given post, as indicated by the oEmbed specification

embed_head” and “embed_footer” can be utilized to include custom code at the start and end of the template. On the off chance that you don’t like this particular feature, you can utilize the Disable Embeds plugin to disable it.

Taxonomy Term Metadata:

WordPress 4.4 introduces a new feature term meta just like post meta. You can add custom fields for terms by using the following functions the same way as for posts:

  • add_term_meta()
  • update_term_meta()
  • delete_term_meta()
  • get_term_meta()

Rest API:

REST API team has announced their merger with WordPress core. According to their merger agreement, the API will consist of two parts – “Infrastructure” and “Endpoints”. According to them, the base infrastructure of the API will be integrated with WordPress, but all the endpoints will still be provided through the plugin.

Now as WordPress is providing the Infrastructure, theme and plugin authors can build their own RESTful APIs in a much eaiser way. The infrastructure will handle all the REST stuff like routing, JSON serialization/deserialization, argument handling, status codes, etc.

If someone still wants to use the endpoints to get the core data from WordPress without any development, then the REST API plugin will be providing the endpoint ready to use.

Comments:

In WordPress 4.4, the comment form fields are reordered in a way that Comment field will come before Name and Email fields. This was done in response to a long awaited bug listed on WordPress trac.

Now in WordPress 4.4, the comments will be Object Oriented and accessed through a class named as “WP_Comment”. WP_Comment_Query now has the following new query parameters to retrieve the comments:

  • parent__in – This will take an array of parent comment ids whose children are to be retrieved
  • parent__not_in – This will take an array of parent comment ids whose children are not to be shown in result
  • hierarchical – This can be set to the following values:
    threaded – This will provide tree formatted comments
    flat – This will not provide the parent child hierarchy, rather all the comments will be on same depth
    false – This will remove child comments from the result
  • orderby – This will have a new parameter comment__in which will be useful to return the same order while querying the object on the basis of comment__in parameter

One more under the hood feature to improve comments performance is splitting comment queries with number of comments (if you want to restrict the comments to a limited number).

wp_title Tag Deprecated:

wp_title tag is deprecated in this WordPress 4.4 version. Instead of this tag, you have to use the following functionality in your theme‘s functions.php file:

User Comments

Leave a Reply

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

Get in Touch