Im trying to show a box on left sidebar with links of current page's sub menus. but order is not applying same as menu! whats the problem? <div class="sidebar-box"> <div class="sidebar-box-title"> <h4><?php echo get_the_title($post->post_parent); ?></h4> </div> <ul class="links"> <?php wp_list_pages('sort_order=asc&title_li=&sort_column=menu_order&depth=1&child_of='.$post->post_parent); ?> </ul> </div> DEMO: http://www.testhosting.co.uk/speedshealthcare/healthcare-supplies/care-home-pharmacy/ … [Read more...] about wp_list_pages sort order by top nav menu order and child of
Menu order wp
How to order WP_Query by parent for hierarchical Custom Post Type?
How can I get all items under specific parent and order them by menu order in hierarchical Custom Post Type? Lets say I have this posts structure: Fruits Apples Bananas Plum Cherry Vegetables Potatoes Beans Beet Nuts Walnut Chia seeds This doesn't work: $args = array( 'post_type' => 'vile', 'posts_per_page' => -1, 'post_parent__in' => array(543), // Only children of Fruits or Vegetables or Nuts 'order' => 'ASC', 'orderby' => 'menu_order' ); $query = new WP_Query($args); Registering CPT add_action( 'init', 'register_vile', 0 ); function register_vile() { $labels = array( 'name' => _x( 'Vile', 'Vile', 'mytextdomain' ), ); $args = array( 'label' => __( 'Vile', 'mytextdomain' ), 'labels' => $labels, 'supports' => array( 'title', 'editor', 'thumbnail', 'page-attributes' ), 'taxonomies' => array( 'post_tag' ), 'hierarchical' => true, 'public' => true, … [Read more...] about How to order WP_Query by parent for hierarchical Custom Post Type?
How to change custom post order ASC/DESC menu_order wise dynamically?
I have created custom post type in back end with sort menu_order post as you can see in the screenshot. http://prntscr.com/gacw95 In back end sorting ASCENDING/DESCENDING working fine. But I need to Sort ASC/DESC on the front side also. When I click on order tab in back end It will be sorting the post in back end but not in front end. How can I sort the custom post in front side when change in the back end? Backend code <?php // ptype_gallery Custom Post Type add_action( 'init', 'ptype_gallery_post_type' ); function ptype_gallery_post_type() { register_post_type( 'ptype_gallery', array( 'labels' => array( 'name' => __( 'Gallery', 'theme' ), 'singular_name' => __( 'Gallery', 'theme' ), 'add_new' => __( 'Add New Gallery', 'theme' ), 'add_new_item' => __( 'Add New Gallery', 'theme' ), 'edit_item' => __( 'Edit Gallery', 'theme' ), 'new_item' => __( 'New Gallery', 'theme' ), 'all_items' => __( 'All Gallery', 'theme' ), 'view_item' => __( 'View Gallery', … [Read more...] about How to change custom post order ASC/DESC menu_order wise dynamically?
Ignore/Skip default value on orderby menu_order?
Is there a way to query all pages and order them by menu_order but ignore those pages that the default value of 0? I was trying to do something like this: $the_query = array( 'post_type' => self::POST_TYPE, 'posts_per_page' => $total, 'product_cat' => $product_category_name, 'orderby' => $orderby, 'suppress_filters' => '0' ); Or do I need to create a filter to alter the WP_Query? any ideas? cheers … [Read more...] about Ignore/Skip default value on orderby menu_order?
wp_get_nav_menu_items wp-admin/customize.php problem
Hello what can I do I somehow get the following error on the custom panel at admin panel. Normally there is no problem on the menu. I only get an error when I enter the Customize page to live the theme live. Fatal error: Uncaught exception 'Exception' with message 'Supplied nav_menu_item value missing property: target' in L:\UwAmp\www\Wordpress\News\wp-includes\customize\class-wp-customize-nav-menu-item-setting.php on line 183 I take the fault both locally and on the server Where I got the error: wp-admin/customize.php Code in function.php file: if(!is_admin()){ add_filter( 'wp_get_nav_menu_items', 'display_lasts_ten_posts_for_categories_menu_item', 10, 3 ); } function display_lasts_ten_posts_for_categories_menu_item( $items, $menu, $args ) { if ( is_admin() ) { return $items; } $menu_order = count($items); $child_items = array(); foreach ( $items as $item ) { if ( 'category' != $item->object || ('category' == $item->object && get_category_children($item->object_id)) … [Read more...] about wp_get_nav_menu_items wp-admin/customize.php problem