Yeah, when Zelda sends Link back in time, Link goes back to before the events of the game started (but with the memory of his adventure still in his head), so he is able to warn of Ganondorf before he is able to do anything evil, and this, supposely, is what the execution we see in
TP was because of.
OoT Link, immediatley after meeting with Zelda as a kid again, then sets off for the events of
MM. Meanwhile, on the adult timeline, there's no Link at all, so when the seal Ganondorf is trapped in (
OoT did occur on this side of the timeline) breaks, he is able to almost destroy Hyrule, making the goddesses flood the land to stop him. Then WW occurs (supposedly, WW and
TP run parallel to each other on the different timelines. Both take place a couple of hundreds of years after
OoT Link). WW then, obviously, leads to
PH and
ST. Every single other Zelda game, for the most part, is up to you to decide. People constantly debate which games go on which timeline. There's also some people who don't believe in the split at all, but even the developers themselves suggest that there is a split. So thats the more detailed explanation for you.