Did Jesus lie about teaching in secret?
Jesus answered him, I spake openly to the world; I ever taught in the synagogue, and in the temple, whither the Jews always resort; and in secret have I said nothing. - John 18:20
And the disciples came, and said unto him, Why speakest thou unto them in parables? He answered and said unto them, Because it is given unto you to know the mysteries of the kingdom of heaven, but to them it is not given. - Matthew 13:10-11 (see also Mark 4:11-12)

What's going in here? Relevant in this matter is ancient teaching methodologies -- see here. Matthew's verse isn't a proclamation of private teaching, but of teaching style. The goal of ancient/Oriental teaching styles (like that of Socrates) is to cause the hearer to think and consider, with the specific design that if they are unwilling to "get the point" they will reject what the teaching implies and go away. But if you want to know more, you ask for an explanation, and a dialogue ensues.

Ancient methods of teaching featured and encouraged interaction between teacher and student, encouraging the student to "work out" the lesson themselves -- as opposed to the modern conception of teaching as a process whereby one takes notes and later regurgitates what they have learned.

That's what Matthew is referring to; John is referring to the actual setting and physical location of Jesus' teaching, which he did publicly: in the synagogue (not, as today, a building, but any assembly of persons, which would include settings like the Sermon on the Mount, homes, etc.), in the Temple, anywhere the Jews met.

-JPH