When we enter into Shiva temple, we can see that Lord Ganesh and Lord Hanuman's statue before the Shiva Lingam.
What is the significance of these two statues in Shiva Temple?
Ganesh Ji was given the boon by Shiv Ji and other Devtas that he will be the first one to be worshiped and then any other God/Goddesses will be worshiped. This all came after an incident in which Shiv Ji cut the human head of Ganesh Ji and then later Mata Parvati got angry and asked to bring him back to life or else she will destroy everything. Shiv Ji arranged an elephant head and placed it on Ganesh Ji's body and brought him to life. After that Shiv Ji and all the devtas gave various boons and blessings to Ganesh Ji, which included the boon of being worshiped first as well. This all is stated in Shiv Purana. Thats why Ganesh Ji's idol is there in nearly every temple.
Regarding Hanuman Ji's statue, it might be because Hanuman Ji is the 11th Rudravtaar. But not sure if Hanumaan Ji is being shown with Shiv Ji. However, as per some texts again from Shiv Purana, sometimes Nandi used to be seen having a monkey face. This is seen in the incident when Demon King Ravana wanted to enter Kailash and Nandi tries to stop him. Ravan insults Nandi because of monkey like face and Nandi curses him that Monkeys will be responsible for his fall.
Ganeshji is a god of senses in our body 24 senses before you worshipped Lord Shiva you should have control on your senses. Same thing with Hanumanji is called Jitendriya (More knowledgeable) there is one another reason to I forgot @ it if remember will share here. there are 5 idols outside of Garbha Gruh of Shivaji's temple. Ganeshji, Hanumanji, Nandi, Tortoise and ONe above the entrance of Garbha Gruh. Noticeably Shivaji's temple entrance is smaller than normal most likely you need to bend your self and than enters. Meaning of that is you have to control senses plus when you entered into Garbha Gruh you've to leave your Ego, proud outside and being a polite you worship Lord Shiva.
The Thing is Lord Ganesha is called as "Mudhar Kadavul" a.k.a First lord. In all the temples Lord Ganesha is worshipped as the first lord so only his statue is at the entrance. During important festivals in temples, all lord statue are placed in vahanas and are shown before lord Ganesha statue before proceeds to streets. He is declared as first god to worship in Hinduism and every other god will seek his permission before doing any proceedings.
Lord Hanuman statue is at the entrance because he will be worshipped after we finish our worship all other gods in that temple. Lord Hanuman is responsible for blessing people with hope so that they don't lose hope on their prayers. He is god of bravery and so he blesses people with confidence. Hence he is worshipped last in every temple.
Lord Gana-Isha is described in Shiva Purana, which describes the Eeshathwa or Eeswra to humanity. Lord Hanuman is described in Vishnu Purana which describes the Eeshathwa to humanity. First school of thought teaches Surya Wamsa- the Sun Cosmic Dynasty. The second one the Chandra Wamsa - Moon Cosmic dynasty. Finally both become the same at the point of Tri-moorthi. Therefore both Ganesha and Hanuman are the samebut only different in school of thought. Remember Mahabhrath and its two fractions - the Kaurava and Kshatriyas and its epitamalogy (Surya - Chandra). Both clans which had the power to dominate the universe originated from one mother. Finally some are destroyed, some surender and some become victorius. The greatest story ever told, the greatest truth about the Parama Siva ( Absolute Brahman) and the absolute secret of the whole Cosmos.
Vigneshwara is vigna hartha meaning the remover of obstacles. Anjaneya is sankat mochan or the remover of calamities. For a spiritual venture or sadhana to be fruitful, one needs a good beginning (ganesha) and a person who helps and sees the job thru completion (anjaneya). Hence they are both present in the temple.