diff --git a/js/notice_manager_panel.js b/js/notice_manager_panel.js index 3fe847f..00ac49a 100644 --- a/js/notice_manager_panel.js +++ b/js/notice_manager_panel.js @@ -77,14 +77,9 @@ var NoticeManager = (function ($, document) { if (options.screen_panel && options.auto_collect) { NoticeManager.collectNotices(); } else { - /** - * Move ALL notices above page title. - * Default no-panel action - override WordPress moving notices BELOW title. - * I HATE it when WordPress moves notices below title. - * - * comment this line out to completely restore WordPress functionality when auto_collect is off - */ - notices.insertBefore(".wrap:first"); + if (options.above_title) { + NoticeManager.moveAboveTitle(); + } } /** @@ -169,5 +164,14 @@ var NoticeManager = (function ($, document) { $("#screen-meta-links").detach(); } }, + + /** + * Move ALL notices above page title. + * Default no-panel action - override WordPress moving notices BELOW title. + * I HATE it when WordPress moves notices below title. + */ + moveAboveTitle: () => { + notices.insertBefore(".wrap:first"); + }, }; }(jQuery,document) ) \ No newline at end of file diff --git a/notice-manager.php b/notice-manager.php index e79dd0d..478f390 100644 --- a/notice-manager.php +++ b/notice-manager.php @@ -30,6 +30,12 @@ new PluginCore( // 'title' => 'N', 'description' => 'Setup How notice manager functions.', 'fields' => [ + [ + 'id' => 'above_title', + 'title' => 'Above Title', + 'type' => 'checkbox', + 'description' => 'Move all notices above title. (WordPress core moves notices below title using script.)', + ], [ 'id' => 'screen_panel', 'title' => 'Notices Panel', diff --git a/src/NoticeManager.php b/src/NoticeManager.php index 0e84c9b..0dc97d9 100644 --- a/src/NoticeManager.php +++ b/src/NoticeManager.php @@ -32,7 +32,7 @@ class NoticeManager{ if ( ! empty( $this->options['screen_panel'] ) ){ add_action( 'admin_init' , [ $this , 'register_notice_manager_panel' ] ); }else{ - array_walk($this->options,function(&$item){$item=0;}); + // array_walk($this->options,function(&$item){$item=0;}); } }