Title: Walker problem : Illegal offset &#8230;
Last modified: August 30, 2016

---

# Walker problem : Illegal offset …

 *  [Techknow999](https://wordpress.org/support/users/techknow999/)
 * (@techknow999)
 * [10 years, 11 months ago](https://wordpress.org/support/topic/walker-problem-illegal-offset/)
 * Hi guys !
 * I’m actually trying to create my own theme. For this, I use the framework [Materialize](http://materializecss.com/).
   There isn’t the problem.
 * To have a nice sidebar, I must get the output of wp_nav_menu() like this :
 *     ```
       <ul class='collapsible collapsbile-accordion'>
       	<li class='bold'>
       		<a class='collapsible-header waves-effect'>$object->title</a>
       		<div class='collapsible-body'>
       			<ul>
       				<li>
       					<a href='$object->url'>$object->title</a>
       				</li>
       			</ul>
       		</div>
       	</li>
       </ul>
       ```
   
 * So, I tried to create a Walker that would make this work.
 *     ```
       class Sidebar_Walker extends Walker {
   
               function start_lvl( &$output, $depth, $args ) {
   
                   if( $depth == 0 )
                       $output .= "<ul class='collapsible collapsbile-accordion'>";
                   else
                       $output .= "<div class='collapsible-body'><ul>";
               }
   
               function end_lvl( &$output, $depth, $args )  {
   
                   if( $depth == 0 )
                       $output .= "</ul>";
                   else
                       $output .= "</ul></div>";
               }
   
               function start_el( &$output, $item, $depth, $args )  {
   
                   if( $depth == 0 )
                       $output .= "<li class='bold'><a class='collapsible-header waves-effect'>".$item->title."</a>";
                   else
                       $output .= "<li><a href='".$item->url."'>".$item->title."</a>";
               }
   
               function end_el( &$output, $item, $depth, $args ) {
   
                   $output .= "</li>";
               }
       }
       ```
   
 * I’m not confident in this code to work and, when I set the Walker as callback
   of wp_nav_menu(), I just get this error :
 * **Warning:** Illegal offset type in D:\XAMPP\htdocs\DIVTEC\wp-includes\class-
   wp-walker.php on line **224**.
 * Line 224 is : $children_elements[ $e->$parent_field ][] = $e;
 * Thanks for reading this, I hope that you can help me !
 * (Sorry for english mistakes I could have done, it isn’t my main language)

The topic ‘Walker problem : Illegal offset …’ is closed to new replies.

## Tags

 * [illegal offset](https://wordpress.org/support/topic-tag/illegal-offset/)
 * [sidebar](https://wordpress.org/support/topic-tag/sidebar/)
 * [Walker](https://wordpress.org/support/topic-tag/walker/)

 * 0 replies
 * 1 participant
 * Last reply from: [Techknow999](https://wordpress.org/support/users/techknow999/)
 * Last activity: [10 years, 11 months ago](https://wordpress.org/support/topic/walker-problem-illegal-offset/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
