Hi, Mikey, First, close the door. ( with you on the side where you want the post) make sure the door is inline with the fence/wall, ( in other words ) make sure it looks straight with the fence.
Now, draw a line down the wall where the door is, you are going to fit the 4 X 2 there, , next cut the 4x2 to the hight you want. but leave it short on the bottom by about an 1" ( this will stop the 4x2 going rotten on the bottom.
You have drawn the line on the brick work, good, place the 4x2 againest the wall and see where the joints are, now drill a hole in the 4x2 say 3/8" this hole must be in the center of a brick ( not the joint) the screws you are going to use are ( 3"1/2" or 4" ) so you must also have the plugs to match that size screw.
Drill half way down the 4x2 and into the wall ( just a little deeper than the plug.) screw in your first screw not too tight but so you can still move the 4x2, now close door and the 4x2 will now be againest the door, when you think it looks good and is inline with the door top and bottom, you can now drill into the 4x2 and the wall, ( into the brick). I, myself would fix the 4x2 with four screws, thats plenty for the job they have to do, and thats about it, you can fit the latch then to suit your requiements... John 2000.. ( PS: paint the 4x2 first, the side that goes to the wall is important)