If I had ~ and I wish I Had ~

A. use ‘if + had (‘d) ~ to’ talk about the past (if had known/ been/ done etc.)
A1. I’m not hungry. If I was hungry, I would eat something. (now) vs. I wasn’t hungry. If I had been hungry, I would have eaten something. (past)
A2. Do not use ‘would’ in the ‘if-part’ of the sentence. We use ‘would’ in the other part of the sentence.
A3.’ ‘d’ can be would or had. (e.g. If I’d seen you. (I’d seen = I had seen), I’d have said hello. (I’d have said = I would have said))
A4. use ‘had (done)’ in the same way after ‘wish’. I wish something had happened = I am sorry that it didn’t happen.
A5. Do not use ‘would have ~‘ after ‘wish’.
A6. If I had gone to the party last night. I would be tired now. (I am not tired now – present) vs. If I had gone to the party last night. I would have met lots of friends. (I didn’t meet lots of friends – past) 

More information with examples…