Unreal conditions with wenn
For something that is not real now, the wenn clause ends in a Konjunktiv II form such as hätte or wäre, and the main clause usually takes würde with an infinitive.
Compare: Wenn ich Zeit habe, komme ich (real: it can happen) and Wenn ich mehr Zeit hätte, würde ich öfter reisen (not real: I do not have the time).
In the wenn clause the verb goes to the end: hätte, wäre, könnte, or würde + infinitive. When the wenn clause comes first, the main clause starts with its verb: würde + infinitive, or hätte, wäre, könnte: Wenn ich mehr Geld hätte, würde ich eine größere Wohnung mieten.
For most verbs use würde + infinitive. haben, sein, können, müssen and sollen have their own forms: hätte, wäre, könnte, müsste, sollte. Other verbs have their own forms too, such as käme or wüsste, and würde + infinitive is correct in their place.
Wishes use the same forms: Wenn ich doch mehr Zeit hätte! Ich wünschte, ich hätte mehr Zeit. After ich wünschte there is no dass.
For the past (Wenn ich das gewusst hätte, …) see the Konjunktiv II of the past.