If the shifter is properly attached to the shift shaft and it is still not shifting, I had a similar problem once, but this was on an old KDX. The shift shaft return spring had popped out of place. On my old bike, the return spring was on the right hand side. I had to pop the cover off the right side of the motor and re-position the spring. It was just below and behind the clutch. It was cheap to fix, but took awhile to figure out what the problem was.
Not sure if that is the problem. You might want to see if you can locate a diagram of your transmission / shifter and see if the shift shaft return spring is easy to get to.