1

I'm working on Single Page WordPress Theme where I want to get_pages() as per custom menu order.

I have gone through the reference for get_pages() which only allows for default menu :

get_pages('sort_order=asc&sort_column=menu_order');

Is there any way to get_pages() as per custom menu order ?

0

I Have Found My Own Solution. I Tried To Get Page ID Of Each Custom Menu Item & Rendered Page Based On That ID.

Reference : wp get nav menu items

Like This...

    $menu_name = 'primary-menu';

    if ( ( $locations = get_nav_menu_locations() ) && isset( $locations[ $menu_name ] ) ) {
            $menu = wp_get_nav_menu_object( $locations[ $menu_name ] );
            $menu_items = wp_get_nav_menu_items($menu->term_id);
            foreach ( (array) $menu_items as $key => $menu_item ) {
                $qcPageID = $menu_item->object_id;
                $qcPageData = get_page( $qcPageID );
            }
    }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.