Wall-sliding help

I was wondering can anyone help me out with my wall-sliding & wall-jumping system?

To elaborate, for a while now I’ve been working on a wall-sliding/wall-jumping system that works like the Mario games & I’ve managed to get almost everything working except for one major feature.

super-mario-bros-wonder-wall-jump

You see currently in my project, wall-sliding automatically activates when the player is in contact with the wall while not touching the ground.

Instead what I want is for wall-sliding to only initiate if the player pushes the directional input of the controller in the same direction as the wall that the player wishes the player character to cling to.

Whereas if the player doesn’t press the directional input while the player character is making contact with the wall then nothing happens and player character will simply fall to the ground as normal.

This is how it works in the Mario games and its what I want to emulate in my own game, which necessitates re-working my current wall slide coding:

The problem though is that I don’t know how to make the directional input work which is why I need help.