a. A 20mm lens is wide enough to allow for more DOF than lets say a 50mm lens set at the same aperture. Lets say that you are taking a photo of a person's face from perhaps 20 feet of distance with a 100mm lens set at f/1.7. While the subject may be in focus, it's very possible for both the foreground and the background to be out of focus or blurred. But switch your camera to aperture priority (Av on Canon), and then change the aperture from f/1.7 to f/8, and now more of the foreground and a lot of the background will be in focus. All you have done is to increase the area in focus (but don't forget that the wider the lens the more of the subject in focus).
b. For a landscape where you want to show both the foreground and background in focus (using your lens), instead of setting the lens aperture to f/1.7, try something like f/11 to f/22 or so. You may have to increase ISO and even use a tripod, but the higher the aperture number, the more of the subject that will be in focus.
c. Lest say that you move away from the subject with the 20mm lens still set to f/1.7. In this case, you still have the same DOF as before, except that more of the foreground (the distance from your camera to the point where the DOF begins) will be blurred, but the DOF will remain the same (the flower will still be in focus). In other words, if you want to show more of the foreground and background that is outside of the lens DOF, just close the lens aperture (turn the lens aperture (with the camera controls) to a higher "f" number. But again, don't forget that the widest the lens the more DOF.
d. When you want to control how much of the subject you want in focus, use aperture priority (Av), and the camera chooses the best shutter speed possible. But in some instances, you may have to increase ISO to prevent blur.
e. In cases where you want to increase blur, switch the camera to shutter priority (Tv on Canon). The camera then chooses the best lens aperture possible. This mode is good for taking photos of moving subjects. For example, a person walking across you field of view, and you want to show the person's legs and arms in a blur (moving), or perhaps when you want to show a stream of water looking sort of milky. In this case, you may have to decrease ISO and also shutter speed. Also, you can do the same by using ND filters. The filters block some of the light, which in turn creates a condition similar to shooting in low light.
f. While your 20mm lens may not be ideal for portraits, a lot of photographers use them. All depends on what you want to achieve. For example, a Canadian professional photographer I know of, takes wonderful images of his children playing indoors (in a small room) with wide-angle and fisheye lenses. His photos not only show the main subject in focus, but also the room. Again, all depends on what you want to achieve. On this one (taken around 12mm), the dog's nose was perhaps 10" from the glass: