diff --git a/README.md b/README.md index bf13fa3..d1df031 100644 --- a/README.md +++ b/README.md @@ -284,6 +284,7 @@ All versions of _Subtitles_ can be found on the [Releases](https://github.com/ph - Bug Fix: Do not show subtitles in RSS feeds (see [issue](https://github.com/philiparthurmoore/Subtitles/issues/32)). - Extra: Russian (ru_RU) language packs added - Extra: Better WordPress Coding Standards +- Extra: WordPress 4.1 introduced a new hook called `edit_form_before_permalink` that allows us to move Subtitles into a more natural position, just underneath the post title. Let's use that and preserve backwards compatibility for older versions of WordPress. ### [v2.0.0](https://github.com/philiparthurmoore/Subtitles/releases/tag/v2.0.0) (August 31st, 2014) diff --git a/admin/assets/css/subtitles.css b/admin/assets/css/subtitles.css index 94d30a0..e68e616 100644 --- a/admin/assets/css/subtitles.css +++ b/admin/assets/css/subtitles.css @@ -14,6 +14,10 @@ margin-bottom: 10px; margin-top: -5px; } +.version-4-1 #subtitlediv { + margin-bottom: 0; + margin-top: 0; +} #subtitlediv label { cursor: text; diff --git a/admin/subtitles-admin.php b/admin/subtitles-admin.php index 3d85943..167fee4 100644 --- a/admin/subtitles-admin.php +++ b/admin/subtitles-admin.php @@ -89,7 +89,11 @@ protected function __construct() { * * @since 1.0.0 */ - add_action( 'edit_form_after_title', array( &$this, 'build_subtitle_input' ) ); + if ( version_compare( $GLOBALS[ 'wp_version' ], '4.1-alpha', '<' ) ) { + add_action( 'edit_form_after_title', array( &$this, 'build_subtitle_input' ) ); + } else { + add_action( 'edit_form_before_permalink', array( &$this, 'build_subtitle_input' ) ); + } /** * Validate and update the subtitle input field.