This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

2

As per my answer, I would suggest that is not a duplicate, as this question specifically asks how to maintain the entire wall in focus while other objects are not in focus.
– cajunc2Feb 22 '16 at 19:15

Because your question mentions keeping other areas of the photo out-of-focus, I assume you've considered and rejected the possibility of a smaller aperture to increase depth of field. If that is not the case, the question posted in the comments as a possible duplicate is an excellent resource.

To achieve the effect you're looking for, one option is to use a camera which allows you to tilt the lens relative to the focal plane. This can be done with most large-format cameras, a few medium-format cameras, and a few special lenses on 35mm cameras (commonly called perspective-control or tilt-shift lenses).

The principle behind their operation is the Scheimpflug Principle. Essentially, when you tilt the plane of the lens, you shift the plane of focus as it appears on your film or sensor. In the case of your example photo, a tilt to the right of the proper amount (properly, a "swing" to the right; tilts are up and down) would bring the plane of focus in line with the wall and you could achieve sharp focus along the wall even with a shallow aperture.

It's a fairly advanced topic to discuss, but it becomes intuitive when explored hands-on with the appropriate equipment.

As your original question is tagged Nikon, I assume you'd be looking for Nikon lenses. To my knowledge, Nikon offers three lenses that allow for movements:

Thanks for the answer. They were indeed very expensive. I don't think I will ever afford one. So I guess I will never be able to achieve this effect. So the only solution I have is using a smaller aperture.
– ChrisFeb 22 '16 at 21:19

1

You might also consider a lensbaby solution. It's much cheaper. Image quality generally sucks (so does the Holga's but a lot of people like the effect) but you can replicate a tilt/shift look. See lensbaby.com/usa/spark.php for info...
– BobTFeb 22 '16 at 21:26

@Chris: If you really wanted to get everything in focus, you could get a used 4x5 system with lens and film holders for ~$500. The image quality would be astonishing, but you would pay upwards of $10 per shot exposed and developed, and that's not even getting your shots scanned or printed.
– Dietrich EppFeb 23 '16 at 3:13