Calculation you talking about going here:
if( !isset( $this->break_point ) )
$this->break_point = ceil( $this->current_menu->count / 2 ) + 1;
You can’t get top-level items count this way. Instead you should count it yourself. You can do this using wp_get_nav_menu_items(). Every top-level item should have menu_item_parent set to ‘0’.
You should create additional variable where you calculate already displayed elements. So top of your file should looks like this:
class Split_Menu_Walker extends Walker_Nav_Menu {
public $break_point = null;
public $displayed = 0;
function start_el(&$output, $item, $depth, $args, $id=0) {
global $wp_query;
if( !isset( $this->break_point ) ) {
$menu_elements = wp_get_nav_menu_items( $args->menu );
$top_level_elements = 0;
foreach( $menu_elements as $el ) {
if( $el->menu_item_parent === '0' ) {
$top_level_elements++;
}
}
$this->break_point = ceil( $top_level_elements / 2 ) + 1;
}
$indent = ( $depth ) ? str_repeat( "\t", $depth ) : '';
...
...
...
Then you should increment $this->displayed++;
every time you display top level element (for example at the end of start_el() function):
if( $item->menu_item_parent === '0' ) {
$this->displayed++;
}
Lastly instead of
if( $this->break_point == $item->menu_order )
you should use
if( $this->break_point == $this->displayed )