How to sort a sub-menu, generated with get_pages(), by the page order instead of alphabetically?

So this is the way I eventually achieved this. I put the following code into my functions.php (actually into the functions.php of my child theme to keep it safe from updates) It has just one change to the original code from the link in the question thanks to @birgire. /** * auto_child_page_menu * * class … Read more

How to change custom post order ASC/DESC menu_order wise dynamically?

You can hook pre_get_posts and use the order_by argument of WP_Query. From a plugin or functions.php of active theme, something like the following (untested example): add_action( ‘pre_get_posts’, ‘my_post_type_sort’, 10, 1); function my_post_type_sort( $query ) { if ( is_admin || ! $query->is_main_query() ) { return; } if ( $query->get(‘post_type’) !== ‘name_of_post_type’ ) { return; } $query->set(‘orderby’, … Read more

Sort get_children by menu_order

Following WordPress 3.5, gallery shortcodes now include the image IDs by default. Like this which also holds the order, so open the plugin file named carousel-gallery-jquery.php and replace this line: (around line 140) $attachments = get_children( array(‘post_parent’ => $id, ‘post_status’ => ‘inherit’, ‘post_type’ => ‘attachment’, ‘post_mime_type’ => ‘image’, ‘order’ => $order, ‘orderby’ => $orderby) ); … Read more

WordPress Admin Menu Order for ‘admin.php’ pages

Instead of this: return array( ‘index.php’, // Dashboard ‘separator1’, // –Space– ‘edit.php?post_type=page’, // Pages ‘edit.php’, // Posts ‘edit.php?post_type=portfolio’, // Portfolio ‘admin.php?page=wpcf7’, // Contact Form 7 ‘upload.php’, // Media ‘edit-comments.php’, // Comments ); try this: return array( ‘index.php’, // Dashboard ‘separator1’, // –Space– ‘edit.php?post_type=page’, // Pages ‘edit.php’, // Posts ‘portfolio’, // Portfolio ‘wpcf7’, // Contact Form … Read more