Created
April 23, 2025 22:08
-
-
Save taricco/0495ccd236ed5a40f4ccdfbe401abada to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /*** IMPORTANT: The plugin Admin and Site Enhancements (ASE) hides the notices. ***/ | |
| /*** Posts Alert Message | |
| Notes: notice-error #d63638, notice-warning #dba617, notice-success #00a32a, notice-info #72aee6. | |
| ChatGPT Generated | |
| –––––––––––––––––––––––––––––––––––––––––––––––––– ***/ | |
| function posts_admin_notice() { | |
| global $pagenow; | |
| // Check if on the regular Posts list page | |
| if ( $pagenow === 'edit.php' && !isset( $_GET['post_type'] ) ) { | |
| ?> | |
| <div class="notice notice-warning is-dismissible custom-admin-note"> | |
| <p><strong>TIP:</strong> This message appears only on the regular Posts list page.</p> | |
| </div> | |
| <style> | |
| .custom-admin-note { | |
| background-color: #dba617; | |
| color: #000; | |
| } | |
| </style> | |
| <?php | |
| } | |
| } | |
| add_action( 'admin_notices', 'posts_admin_notice' ); | |
| EXAMPLE HTML | |
| <div class="notice notice-success" style="background-color: #00a32a; color: #ffffff;"> | |
| <p><strong>TIP:</strong> Follow <a href="#" style="color: #ffffff;" target="_blank">these instructions</a> for adding a Template Part to the classic WordPress menu.</p> | |
| </div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment