Many toilets have a horizontally stretched drain pipe. With this method, the drain pipe will go downwards at one point, so it can deliver your waste to the sewage system.
You could also establish your vent connection so it is under the toilet. To do this, you need to place the vent on your vertical waste pipe before it can reach the elbow’s turning point.
This method needs a reducing wye so you can attach the vent properly. The wye will let you change the vent angle so that it can separate from the toilet drain pipe when needed.
Then, attach a street elbow with a 45-degree angle to your wye. These two parts will hold the vent pipe vertically so it can stand still behind your bathroom wall.