Today is the day you shall learn about finite state machines.
Google it for an in-depth explanation.
But the gist is, give your character an instance variable "state", that then is set to the characters current state (cling, idle, walking, falling,...)
Character clings to wall -> state = "cling"
Now you can compare when pressing the button: Is character state "cling", do X, else do Y