WordPress.org

Ready to get started?Download WordPress

Forums

Admin Hook for Welcome Screen / Dashboard (6 posts)

  1. crgeary
    Member
    Posted 2 years ago #

    Would it be possible in future version of WordPress to include a hook on the dashboard either before or after the welcome message, so that we can create our own welcome messages, or useful information for clients who we use wordpress for. At the moment we are using dashboard widgets for this, but it doesn't give as much freedom over the design.

    I've done it to my own WordPress test site, but obviously I had to edit a core file (which was ok for my test site, because well its a test site), but no-body should edit core files on live sites. EVER!

    Just something simple so we can do:

    add_action( 'admin_welcome_before', 'custom_function_to_call' );

    :) Thanks for making the most awesome CMS ever!

  2. Why not admin_head?

    Or look at how Hello Dolly does it.

  3. crgeary
    Member
    Posted 2 years ago #

    admin_head is called inside the <head> tag, and is for stylesheets and misc stuff that belongs in the <head> of the site (similar to wp_head on the front end).

    Hello dolly hooks to the admin notices, which are called before the content, so the "custom welcome message" will be displayed above the page title.

    It's possible to hook it to the notices, and then use css to move everything around, but its an ugly method. :)

  4. kreynol7
    Member
    Posted 2 years ago #

    To add to Crgeary post. I simply used the "admin_notices" hook and called my new function. Then i used css to float the welcome panel to the left and all was fixed. Here is my code

    To view all hooks on a page checkout:
    http://wp.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks

    To view hooks db: http://adambrown.info/p/wp_hooks/version/3.3

    To view wordpress source code checkout: http://xref.yoast.com/
    Replace all of the div content in the welcome screen below with your content.

    [ 96 lines of code moderated. For more than 10 lines of code please use pastebin.com instead. ]

    DONT FORGET TO THEN ADD CSS: float:left on the .welcome-panel div and then all should be fixed.

  5. jcow
    Member
    Posted 2 years ago #

    "admin_notices" is a really great hook. That was exactly what I needed. Thanks kreynol7.

    Use this to hide the welcome message:

    add_action('load-index.php', 'hide_welcome_message_panel');
    	function hide_welcome_message_panel() {
    		$user_id = get_current_user_id();
    		update_user_meta( $user_id, 'show_welcome_panel', 0 );
    	}
  6. k3davis
    Member
    Posted 1 year ago #

    I'd like to evaluate this also (not sure if I'll like it, or not), but the code was removed from the post above... anyone care to pastebin or similar how you did this?

    In my case I'd like to tie it to a plugin setting (applies to all users) rather than a user meta - show only until it has been dismissed, no matter who dismissed it. But I can probably sort that bit out myself given the above.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags