Some semiconducting metal oxides as e.g. tin dioxide (SnO2), tungsten trioxide (WO3) or cobalt oxide (Co3O4) are well-known for their gas-dependent electrical properties and therefore they are utilized as active components in highly sensitive and cost-efficient resistive type gas sensors. Recently it was shown that it is possible to utilize the correlation of the electrical and the optical properties of these materials to build a new type of optical gas transducer based on metal oxide photonic crystals. However, a detailed theoretical description of the linking mechanism between the optical and the electrical property change was still missing. Utilizing n-type semiconducting WO3 for the detection of hydrogen (H2) as a model system we have shown, that free carrier absorption plays an important role in understanding the change in optical properties and the complex refractive index of WO3, respectively. In the presented work we will test this idea on p-type Co3O4 for the detection of carbon monoxide. Therefore we synthesized cobalt(II,III) oxide photonic crystals (inverse opals) by a sol-gel based templating method. As expected, a gas induced change in the electrical properties can lead to a shift of the reflection peak due to a change in the refractive index of the material. We show that the characteristics of this optical response (e.g. its magnitude) can be manipulated by photonic band gap engineering, e.g. setting the stop band to the NIR range leads to an increase of the optical response compared to a stop band in the visible regime. The observed behavior is discussed by means of the optical dispersion of the complex refractive index of Co3O4 and the Lorentz-Drude model.