Ask questions about WordPress courses

Displaying a message in the WordPress admin

Displaying a message in the admin WordPress standard means CMS, great code loya of those who write plugins. Try pasting the code in a file function.php and go first to the plugins section, and then to the settings section. When you navigate to your site, a message should be displayed. I haven’t figured out where to use this code yet, but I left it as a note, at the time when I start writing high-quality plugins on my own ).

add_action( 'admin_enqueue_scripts', 'my_admin_enqueue_scripts' );
function my_admin_enqueue_scripts() {
    wp_enqueue_style( 'wp-pointer' );
    wp_enqueue_script( 'wp-pointer' );
    add_action( 'admin_print_footer_scripts', 'my_admin_print_footer_scripts' );
}
function my_admin_print_footer_scripts() {
    $pointer_content = '<h3>wp-admin.com.ua | wordpress lessons</h3>';
    $pointer_content .= '<p>Читайте наши статьи и пишите сами.</p>';
?>
   <script type="text/javascript">
   //<![CDATA[
   jQuery(document).ready( function($) {
    $('#menu-appearance').pointer({
        content: '<?php echo $pointer_content; ?>',
        position: 'left',
        close: function() {
            // Once the close button is hit
        }
      }).pointer('open');
   });
   //]]>
   </script>
<?php
}

Code snippet example:

wordpress-message-show Выводим сообщение в админке WordPress

Try and test codes, if something is wrong, or is there a better code snippet, write me in the comments, we will refine. Good luck with development!

Nikolaenko Maxim

Director of web studies ProGrafika. I am developing, website design and promotion. Always glad to new blog readers and good clients.


You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Templates for WordPress
The best hosting in Ukraine
Stable hosting for Drupal