If it is coming and going like that, I would agree that the issue is in the shifter and/or linkage. If it were an internal transmission problem, it would stay broken and not get better. Also check that the clutch is engaging properly. If it is still turning the trans input shaft when you press it in, that will cause shifting issues.