Version 4.1

来自WordPress中文文档
跳转至: 导航搜索

wordpress.org.cn

On December 18, 2014, WordPress Version 4.1, named for jazz musician Dinah Washington, was released to the public. For more information on this enhancement and bug-fix release, read the WordPress Blog, and see the Changelog for 4.1.

Highlights

  • New Default Theme - Twenty Fifteen
    • Clean, blog-focused theme, designed for clarity.
    • Your content always takes center stage, whether viewed on a phone, tablet, laptop, or desktop computer.
    • Great language support, with help from Google’s Noto font family. The straightforward typography is readable on any screen size.
    • Designed to maximize tools available in the Customizer.
  • The Finer Points
    • Distraction-free writing: Just write. Sometimes, you just need to concentrate on putting your thoughts into words. Try turning on distraction-free writing mode. When you start typing, all the distractions will fade away, letting you focus solely on your writing. All your editing tools instantly return when you need them.
    • Choose your language - Right now, WordPress 4.1 is already translated into 44 languages, with more always in progress. You can switch to any translation on the General Settings screen.
    • If you’ve ever worried you forgot to sign out from a shared computer, you can now go to your profile and log out everywhere.
    • Inline toolbar gives you quicker access to image editing tools.
    • Plugin installer suggests plugins for you to try. Recommendations are based on the plugins you and other users have installed.
    • Embedding videos from Vine is as simple as pasting a URL onto its own line in a post.
  • For Developers
    • Complex queries - Meta, date, and term queries now support advanced conditional logic, like nested clauses and multiple operators - A OR ( B AND C ).
    • <title> tags in themes - add_theme_support( 'title-tag' ) tells WordPress to handle the complexities of document titles.
    • Customizer API - Expanded JavaScript APIs in the customizer enable a new media experience as well as dynamic and contextual controls, sections, and panels.
    • Developer reference - Continued improvements to inline code documentation have made the developer reference more complete than ever.

What's New

General

  • Show the number of approved comments, instead of total comments, in the “At A Glance” section in the dashboard.
  • Site Language: Install translations on the fly on the General Settings screen. The language drop down now includes installed languages and all available translations when the filesystem is writable by WordPress.
  • Admin notices: There are now four types of notices: success (green), warning (orange), error (red), and info (blue).

Posts

  • Spellchecking is enabled for the post title field on the Edit Post screen.

Media

  • Disable multi-file uploading in iOS 7.x Safari as it prevents uploading of videos.
  • Allow PSDs (Photoshop documents) to be uploaded.
  • oEmbed: Add support for the Vine endpoint.
  • Display error message when Media Library upload fails.

Appearance

  • Custom Header and Custom Background screens removed. Admin menu links now go to the Customizer.
  • Widgets screen now has a Manage in Customizer link at top of screen.
  • Themes: Make "Live Preview" the primary action and “Activate” secondary.

Users

  • Introduce a button on the user profile screen which clears all other sessions, and on the user editing screen which clears all sessions.

Accessibility

  • Admin menu separators are now hidden from screen readers.
  • Improved keyboard control of Edit Selection mode in the media manager.
  • Improved keyboard accessibility on Custom Header and Custom Background screen.
  • Improved text contrast against dark backgrounds in the admin menu and toolbar.
  • When switching to the Text editor, make the textarea visible to screen readers.
  • Use <button> instead of <a> for the Visual/Text buttons to make them focusable.
  • Improve the focus style for review links in the plugin info modal.
  • TinyMCE:
    • Return focus to the editor on pressing Escape while the image toolbar is focused.
    • Add a Close button to the Help modal and close it on Escape.
    • Override the title on the editor iframe (read by screen reader apps), replace with the Alt+Shift+H shortcut.
    • Add focus shortcuts descriptions to the Help modal.

Multisite

Under The Hood

General

  • Lots of new unit tests added, reorganization of Multisite unit tests, and review/removal of failing tests. The base PHPUnit tests now take less than half the time to run than in 4.0, despite the improved coverage.

JavaScript

  • Formal adoption of JSDoc3 for documentation
  • Improvements to documentation in media views
  • Heartbeat: Use the page visibility API (when available) and document.hasFocus() instead of window.onfocus/onblur

Customizer

  • “Theme Customizer” is now just “Customizer”, since it isn’t necessarily theme-specific.
  • Expanded JavaScript APIs in the Customizer enable support for dynamic and contextual controls, sections, and panels.
  • Only changed settings are now sent to preview for better performance.
  • Alternative API that allows controls to be written as JavaScript templates extending WP_Customize_Control::content_template() and render these controls on the client without any server-side call.
  • Color control listens to other controls that might change color settings (like Color Scheme select in TwentyFifteen) and updates wpColorPicker value accordingly.
  • Screen reader users receive feedback when moving widgets up or down.
  • Panels and sections have their type added as CSS class in their HTML container using WP_Customize_Panel::$type and WP_Customize_Section::$type respectively.
  • Sections added to a panel are now rendered in its own method, WP_Customize_Panel::render_content(), separated from the panel container, allowing to override a panel and its contents independently.
  • When an object value is updated, a change event is no longer incorrectly triggered if the object value was unchanged. Uses Underscore's _.isEqual() to compare the object values.
  • Introduces customize_preview_{$setting->type} action hook to handle preview of multiple settings of the same type when they're not a theme_mod or an option. Hooked Functions receive the WP_Customize_Setting instance as parameter.
  • Customizer elements are now JS-rendered, so a stable sorting for panels, sections and controls was added in JS. Sorting in PHP was improved and section, panels and controls store their instantiation order in $instance_number property in each class.
  • Controls of range type now listen for input and propertychange events so the value is updated on mouse drag and not only on mouse release.

Bug Fixes

  • Fix setting default quality in WP_Image_Editor.
  • Always sanitize user_nicename in wp_insert_user() to avoid broken author archive permalinks.
  • Don’t list delete or trash as bulk actions for the relevant context of Post list table if current user does not have the delete_posts cap on the current post type.
  • Don’t print an empty HTML markup when comment_reply_link() returns no link.
  • Avoid a PHP notice in list_plugin_updates() if plugins_api() returned a WP_Error object.
  • Plugin search: Wrap results in a form to fix pagination’s paged input field.
  • Use correct links for filtering plugin reviews.
  • Quicktags: move focusing the editor after inserting content to the end of the code blocks.
  • Add size to the UI for Gallery Settings in the media modal. Ensure that the TinyMCE view is refreshed when size changes.
  • Theme Install: Fix some theme install style issues:
    • Move the "based on" string below the rating to avoid wrapping to a second line.
    • Reduce the gap between the theme screenshot and description.
    • Fix Install button height on mobile.
  • TinyMCE:
    • When pasting/inserting content before a view, add new paragraph above it and insert the content there.
    • Fix the wpgallery plugin to use a placeholder for galleries when either the wpview plugin or wp.mce is not loaded.
    • Update the default styles: increase the font size, and ensure it is the same size in tables.
  • Full-height editor:
    • Reset the editor height after the window is resized.
    • Better calculation for the caret position when auto-scrolling while typing. Fix auto-scrolling for non-WebKit browsers when the caret is above the top of the editor.

Bundled Themes

  • Prevent the arrow in “Continue reading” links from wrapping to a second line.
  • Add an alt attribute with the site title for header images linked to the home page.

Twenty Fourteen

  • Include Latin Extended font subset for Lato.
  • Improve post thumbnail HTML output
  • Add aria-hidden attribute to reduce verbosity on archive pages
  • Add alt text in archives to avoid confusing link texts
  • Replace ellipses appended to automatically generated excerpts with both ellipses and a “Continue Reading” link to meet accessibility-ready requirements
  • Make featured content in Customizer contextual to the front page

Twenty Thirteen

  • Replace ellipses appended to automatically generated excerpts with both ellipses and a “Continue Reading” link to meet accessibility-ready requirements
  • Fix non-responsive layout in IE8.
  • Use proper method for retrieving Customizer settings values
  • Add bottom margin to audio and video players

Twenty Twelve

  • Fix jQuery selector for menu items with submenus on mobile
  • Use proper method for retrieving Customizer settings values

Twenty Eleven

  • Add bottom margin to audio and video players

Twenty Ten

  • Add bottom margin to audio and video players

Themes

  • Introduce a new means of outputting a <title> tag in the theme head. Requires a theme to add support by calling add_theme_support( 'title-tag' ).
  • Improve body class for page templates:
    • Also convert slash to dash.
    • Add sub-folder name as a separate body class.
    • New classes are additional classes, old syntax will persists for backwards compatibility.
    • For example, /page-templates/full-width.php will produce page-template, page-template-page-templates, page-template-full-width, and page-template-page-templatesfull-width-php.

Media

  • Media Grid/List Table parity: when MEDIA_TRASH is true and trash is the current filter for the grid, add a second bulk action button: "Delete Selected".
  • Account for orphan sizes in wp_delete_attachment() by looping over the sizes stored in metadata, instead of relying on the current sizes stored in $_wp_additional_image_sizes.
  • Don't hardcode height for videos so responsive videos work properly.

Revisions

  • Allow revision Backbone classes to be used on pages other than revision.php.
  • Add a single responsibility function for outputting Revisions JS templates: wp_print_revision_templates(). Use it in wp-admin/revision.php.
  • Revisions modules should not rely on global settings; only pass in global settings on init, this allows the classes to be used agnostically elsewhere.

Translations

  • Remove translations when deleting a theme or a plugin.

Multisite

  • Don't send a welcome notification when noconfirmation has been flagged.
  • Don’t display update count for Themes when the user doesn’t have the update_themes cap.
  • Don’t display update count for Plugins when there aren’t any or the count is 0.
  • Properly check if the theme is active on the main site to avoid deleting it via bulk actions.
  • Include the login URL in the wp_new_blog_notification() email template.
  • In activate_plugin(), do not re-run the activation routine for already-active network-wide plugins.
  • Optimize site query when performing network database upgrades.
  • Improve width of input fields on Add New Site and Edit Site screens in Network admin.

Query

  • WP_Meta_Query, WP_Tax_Query, and WP_Date_Query now support a nested query syntax, allowing for much more complex and comprehensive queries.
  • The efficiency of meta and tax queries has been improved, with redundant table joins having been eliminated in many cases.
  • 'orderby=meta_value' now works properly when used in a meta query with the relation 'OR'.
  • Tax queries now support the 'EXISTS' and 'NOT EXISTS' operator.
  • Date queries can now be used properly in conjunction with meta and tax queries.
  • The parameters passed to date queries are now checked to ensure that they contain valid date values, generating errors for developers when invalid dates are detected.
  • Users can now be queried by date queries against the 'user_registered' column.
  • "Inclusive" logic for date queries has been improved when using the 'before' or 'after' parameters.

Comments

  • Add a class attribute for submit button in comment form.
  • Add an aria-label attribute with commenter’s name to get_comment_reply_link().
  • Add aria-describedby attributes to comment_form().
  • comments_template() now uses WP_Comment_Query when fetching comments, rather than making a direct query to the database. This simplifies and standardizes the techniques required to customize comment queries across front- and back-end interfaces.
  • New parameters for WP_Comment_Query::query():
    • 'comment__in'
    • 'comment__not_in'
    • 'post_author__in'
    • 'post_author__not_in'
    • 'author__in'
    • 'author__not_in'
    • 'post__in'
    • 'post__not_in'
    • 'include_unapproved'
    • 'type__in'
    • 'type__not_in'

Classes

What's New

Functions

What's New

Deprecated

Actions & Filters

New Actions

New Filters

External Libraries

  • Update to TinyMCE 4.1.7
  • Update to getID3 1.9.8
  • Update to MediaElement 2.16.2
  • Update to Iris 1.0.7

模板:Versions