why ionic compounds are bad conductors of electricity and good conductor in molten or aqueous
Electric charge is transferred by physically moving charged particles around. In the case of an electric current moving through a wire (for example), the electrons are moving.
In an ionic compound, the ions are locked in place. They can move around a little bit, but there is not much translational motion - the ions stay in their places on the crystal lattice. In addition, the ions are "happy" with the number of electrons that they have. The ions formed in the first place by giving up or accepting electrons in order to minimize the overall potential energy of the system. If an anion were to transfer an electron back to a cation (for example) the energy of the system would increase, and so in general, transfer of electrons after the compound has formed is not favorable.
In solution or in a molten state, the ions themselves can move around - they become the charge carriers. In a solid, the ions can't move, and so electricity cannot be easily transferred.
You mentioned heat transfer - heat is the transfer of the kinetic energy of atoms and molecules. Heat can still be transferred (in some cases quite easily) in an ionic solid because, as you said, ions can vibrate about a mean position. When this happens they bump into their neighbors, which spreads the kinetic energy around.
In summary, ionic compounds don't conduct electricity very well because the charge carriers can't move through the crystal. They can conduct heat because the kinetic energy itself is the "heat carrier" - it can be transferred without moving ions too far from their mean positions.