When writing conditional sentences, or any other sentences that contain clauses, one must always be attentive to the compatibility of tenses.
Keep in mind, also, that the word if calls for the subjunctive mood. (this is why we say if I were you, if this be true, he will learn, if he only listen to the professor--the verbs are in the Subjunctive mood)
e.g. Mary would have attended the meeting yesterday, if she had not been out of town. (Conditional present perfect --past perfect, Subjunctive mood.)
or--Mary could attend today if she were not ill. (Present conditional with present subjunctive)
You may wish to consult the site below for more explanations