wordpress menu order

Posted on 2013-06-11
Last Modified: 2013-06-11

I have the following code and I was wondering if it was possible to order by menu_order instead of alphabetically.

			if ($pages_data) {
			$item_output .= '<div class="drop"><div class="holder"><ul>';
			foreach($pages_data as $page){ 
				$item_output .= '<li class="" id="menu-item-'.$page->ID.'"><a href="'.get_permalink($page->ID).'">'.$page->post_title.'</a></li>';
			$item_output .= '</ul></div></div>';

Open in new window

Question by:movieprodw
LVL 70

Accepted Solution

Jason C. Levine earned 500 total points
ID: 39238685
$pages_data=get_pages(array('child_of'=>$item->object_id, 'sort_column' => 'menu_order'));

Read the Codex for more information:

Author Closing Comment

ID: 39239691

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Popularity Can Be Measured Sometimes we deal with questions of popularity, and we need a way to collect opinions from our clients.  This article shows a simple teaching example of how we might elect a favorite color by letting our clients vote for …
Foreword (July, 2015) Since I first wrote this article, years ago, a great many more people have begun using the internet.  They are coming online from every part of the globe, learning, reading, shopping and spending money at an ever-increasing ra…
The purpose of this video is to demonstrate how to exclude a particular blog category from the main blog page. This is can be used when a category already has its own tab, or you simply want certain types of posts not to show up on the main blog. …
The purpose of this video is to demonstrate how to set up basic WordPress SEO. This will be demonstrated using a Windows 8 PC. The plugin used will be WordPress SEO by Yoast. Go to your WordPress login page. This will look like the following: myw…

914 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now