How does one get a temple recommend?

To get a recommend, basically, you need to:

(1) have been baptized for a year (or if baptized as a child, you need to be around 20 yrs old)

(2) have an interview with your bishop (head of local congregation) as well as with the "stake president" (responsible for roughly 10 congregations). They will essentially ask you if you continue to live by the requirements agreed upon at baptism. These include things like "the Word of Wisdom" (avoiding alcohol, black tea, coffee, tobacco, illegal drugs) and "the law of chastity" (avoiding pre- or extra-marital sex), as well as believing in Jesus Christ, being honest, supporting the leaders of the church, etc.

It used to be (say, until about 15-20 yrs ago) that people would only get a temple recommend if they were (a) about to become a full-time missionary, or (b) about to get married, but that has changed now to the point where pretty much every one who wants to, and who is worthy, can get one when they're 20-30 yrs old.

Come to think of it, my description is not entirely correct. That is because there is sort of two or three levels of temple attendence, having to do with the different sacred ordinances that are performed there.

Level 1, by my reckoning, is when a couple is baptized and goes to the temple approximately a year later to be "sealed" together for eternity, all of their children regardless of age, may go with them to be "sealed" as a family. Although the couple must be adults (say over about 20 yrs old), there is no age requirement on the children. I think that children in this category, who are too young to be baptized (less than eight years old) do not need any sort of interview. (But I may be wrong.)

Level 2, by my reckoning, is when youth go to the temple to perform proxy baptisms. I think they must be 12 yrs old (but it may be 14 yrs) to do this. They typically do not participate in any of the other ordinances other than the baptisms (and confirmations, which occur immediately thereafter). The baptisms may be performed for deceased ancestors of the kids, or possibly other deceased individuals. The youth must have recommends from their bishops, but not from the stake president.

Unlike most other things in the temple, the baptisms are only done by proxy. (For example, the sealings mentioned above are done for the actual couple, and there are also sealings performed for deceased families by proxy.)

Level 3, is what is normally referred to when someone talks about "going to the temple", and involves the "endowment" ceremony. Basically, adults make additional commitments, and receive promises of additional blessings. This is called "receiving your endowment", and for adults must be done before a sealing (or a temple marriage ceremony) may take place. As with the sealing, the endowment can be performed both for the actual individuals, as well as for deceased individuals by proxy. This is where the age guideline of approximately 20 yrs old is used, and interviews must be done by both bishop and stake president.