There are probably a lot of solutions, and many that would only work in very specific situations. As long as you have something that does what you want with no side effects, that will do.
The idea I would offer, is that if you want things to cling to slopes, you would cast gravity in the direction of the collision normal of the surface.
Check your angle of whatever you're colliding with the surface, then take the collision normal and multiply it by your gravity. This will be your new gravity vector.
Now when they jump you likely want to resume doing gravity normally, but if your game is something where you're using gravity boots, maybe you check a flag for gravity boots, and continue applying that surface normal. (With some additional checks for other things.)