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

Using menu_position to add two entries between Dashboard and Posts

The order of the menu items can be changed using the filter menu_order add_filter( ‘menu_order’, ‘se354759_menu_order’ ); add_filter( ‘custom_menu_order’, ‘__return_true’ ); function se354759_menu_order ($menu_order) { $cpts = [ ‘edit.php?post_type=” . “custom-post-type’, ‘edit.php?post_type=” . “another-cpt’ ]; // // remove and save first item (“dashboard”) in variable $first_item = array_shift( $menu_order ); foreach( $cpts as $ctp ) … Read more

rearrange the posts by published date in Menu posts selection

add_action( ‘pre_get_posts’, ‘AS_order_posts_in_menu_admin’ ); function AS_order_posts_in_menu_admin( $q ) { global $pagenow; if(‘nav-menus.php’ !=$pagenow) return $q; if(isset($q->query_vars[‘post_type’]) && $q->query_vars[‘post_type’]== ‘post’){ $q->query_vars[‘orderby’] = ‘date’; $q->query_vars[‘order’] = “DESC”; } return $q; }

Changing menu order of a specific plugin in dashboard

I could see “WP Links Page” is a custom post type, so if it’s not registered by your own code, e.g. it’s registered by a plugin (using register_post_type()), then you can use the register_post_type_args filter to change the menu_position argument like so: add_filter( ‘register_post_type_args’, ‘my_override_register_post_type_args’, 10, 2 ); function my_override_register_post_type_args( $args, $post_type ) { // … Read more

Exclude pages by menu order

Declare the following function in your functions.php function wpse58346_wp_list_pages( $pages, $r ) { foreach( $pages as $key => $page ) { if ( 50 < $page->menu_order ) unset($pages[$key]); } return $pages; } Now before calling wp_list_pages() apply a filter as follows add_filter(‘get_pages’, ‘wpse58346_wp_list_pages’, ”, 2); And after you have called wp_list_pages() you can remove the … Read more

echo menu_order value in my theme

You can’t use get_post_meta since the menu_order is stored in the posts table, like you said. But you can set up an easy database query to get the value. $menu_o = $wpdb->get_var( “SELECT menu_order FROM $wpdb->posts WHERE ID=” . $post->ID ); echo $menu_o;

techhipbettruvabetnorabahisbahis forumuedusedusedusedueduseduseduedusedusedu