Web Design Forum: WordPress Dashboard Widgets - Web Design Forum

Jump to content

WDF
WDF Premium Memberships Reseller Hosting
Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

WordPress Dashboard Widgets Rate Topic: -----

#1 User is online   roothost 

  • Currently accepting new clients
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,463
  • Joined: 06-February 11
  • Reputation: 73
  • Gender:Male
  • Location:Lewes, East Sussex
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 01:27 PM

Is there any way to change the order of the default dashboard widgets using the functions.php file? I can easily add a custom widget but cannot seem to change the order of the default widgets...
0

#2 User is online   brightonmike 

  • Web Guru
  • PipPipPipPipPip
  • Group: Members
  • Posts: 2,996
  • Joined: 27-June 11
  • Reputation: 340
  • Gender:Male
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 16 January 2012 - 01:44 PM

AFAIK not using a simple hook, no. All I can think of, and it's very bloated and messy, is to de-register the default widgets, then add them in manually but in the order you want. But as I say that's very bloated.

Not sure of any other way though.
0

#3 User is online   roothost 

  • Currently accepting new clients
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,463
  • Joined: 06-February 11
  • Reputation: 73
  • Gender:Male
  • Location:Lewes, East Sussex
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 17 January 2012 - 02:07 PM

View Postbrightonmike, on 16 January 2012 - 01:44 PM, said:

AFAIK not using a simple hook, no. All I can think of, and it's very bloated and messy, is to de-register the default widgets, then add them in manually but in the order you want. But as I say that's very bloated.

Not sure of any other way though.

Thanks Mike, yeah I did try that, didn't seem to work though :(

It doesn't matter too much, was just an idea to try and reorder some of the widgets a bit...
0

#4 User is online   Spitfire 

  • Mighty Pirate™
  • PipPipPipPip
  • Group: Members
  • Posts: 891
  • Joined: 05-February 11
  • Reputation: 189
  • Gender:Male
  • Location:Berkshire
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 02:15 PM

You can just click and drag their title bars to re-order them. Plus, if you hit the "Screen Options" button in the top right you can remove one you don't want.

Or are you looking to do it permanently for new WP installations?

This post has been edited by Spitfire: 17 January 2012 - 02:16 PM

0

#5 User is online   roothost 

  • Currently accepting new clients
  • PipPipPipPipPip
  • Group: Members
  • Posts: 1,463
  • Joined: 06-February 11
  • Reputation: 73
  • Gender:Male
  • Location:Lewes, East Sussex
  • Experience:Intermediate
  • Area of Expertise:Web Designer

Posted 17 January 2012 - 02:19 PM

View PostSpitfire, on 17 January 2012 - 02:15 PM, said:

You can just click and drag their title bars to re-order them. Plus, if you hit the "Screen Options" button in the top right you can remove one you don't want.

Or are you looking to do it permanently for new WP installations?

Yeah, more perminently. Currently creating a custom wordpress boilerplate/installation for use on future projects and just wanted to reorder a few things so it flows better.

Adding new widgets is easy, seems moving the default ones is annoyingly awkward! lol
0

#6 User is online   Spitfire 

  • Mighty Pirate™
  • PipPipPipPip
  • Group: Members
  • Posts: 891
  • Joined: 05-February 11
  • Reputation: 189
  • Gender:Male
  • Location:Berkshire
  • Experience:Web Guru
  • Area of Expertise:Web Developer

Posted 17 January 2012 - 03:23 PM

The order of the widgets is stored in an array so you should just be able to shuffle them about into the order you want, for example:
add_action('wp_dashboard_setup', 'every_day_im_shuffling');
function every_day_im_shuffling() {
	global $wp_meta_boxes;
	
	$wp_meta_boxes['dashboard']['normal']['core'] = array(
		$wp_meta_boxes['dashboard']['normal']['high']['dashboard_browser_nag'],
		$wp_meta_boxes['dashboard']['normal']['core']['dashboard_recent_comments'],
		$wp_meta_boxes['dashboard']['normal']['core']['dashboard_plugins'],
		$wp_meta_boxes['dashboard']['normal']['core']['dashboard_right_now'],
		$wp_meta_boxes['dashboard']['normal']['core']['dashboard_incoming_links']
	);
}


You can get the full list of what the various default widgets are called here:
http://codex.wordpre...shboard_Widgets

However, doing that will probably mean that you won't be able to drag and drop the widgets to re-order them any more.

This post has been edited by Spitfire: 17 January 2012 - 03:23 PM

0

#7 User is online   Renaissance-Design 

  • Available for custom WordPress work
  • View blog
  • Group: Moderators
  • Posts: 3,595
  • Joined: 12-August 10
  • Reputation: 559
  • Gender:Male
  • Location:South Wales
  • Experience:Web Guru
  • Area of Expertise:Designer/Coder

Posted 17 January 2012 - 03:51 PM

View PostSpitfire, on 17 January 2012 - 03:23 PM, said:

function every_day_im_shuffling()



Epic win.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users