Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disable Notification Functionality in Post/Page List view in admin #18

Merged
merged 2 commits into from
Jan 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 16 additions & 11 deletions includes/AdminNotices.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,26 @@ public static function maybeRenderAdminNotices() {
return;
}

// Bail if we're on a post or page list view in the admin
if ( $screen->base === 'edit' ) {
return;
}

// Handle realtime notifications
if ( 'plugin-install' === $screen->id ) {
?>
<style>
.newfold-realtime-notice {
margin: 5px 0 15px 0;
}
</style>
<style>
.newfold-realtime-notice {
margin: 5px 0 15px 0;
}
</style>
<?php
}

$page = str_replace( admin_url(), '', Url::getCurrentUrl() );
$notifications = new NotificationsRepository( false );
$collection = $notifications->collection();

// Constant container for admin notices
self::openContainer();

Expand All @@ -45,17 +50,17 @@ public static function maybeRenderAdminNotices() {
function ( Notification $notification ) use ( $page ) {
if ( $notification->shouldShow( 'wp-admin-notice', array( 'page' => $page ) ) ) {
?>
<div class="newfold-notice" data-id="<?php echo esc_attr( $notification->id ); ?>">
<div class="newfold-notice" data-id="<?php echo esc_attr( $notification->id ); ?>">
<?php echo $notification->content; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>
</div>
</div>
<?php
}
}
);
}

self::closeContainer();

self::adminScripts();

}
Expand All @@ -78,8 +83,8 @@ public static function closeContainer() {
/**
* Handle scripts
*/
public static function adminScripts(){
public static function adminScripts() {

// Handle realtime notifications
$screen = get_current_screen();
if ( 'plugin-install' === $screen->id ) {
Expand Down
Loading