Trying to get property of non-object “ wordpress ”

It looks like the $args passed to the function is not an object for some reason. I can’t see the origin of this problem but for a quick solution, you can add $args = (object) $args; before the first time you use $args, here on line 44

Also, as commented by toscho, dropdown_menu() is not a valid function in wordpress core