We report density functional theory (DFT) investigation of $B$-site doped CaFeO$_3$, a prototypical charge-ordered perovskite. At 290 K, CaFeO$_3$ undergoes a metal-insulator transition and a charge disproportionation reaction 2Fe$^{4+}$$rightarrow$Fe$^{5+}$+Fe$^{3+}$. We observe that when Zr dopants occupy a (001) layer, the band gap of the resulting solid solution increases to 0.93 eV due to a 2D Jahn-Teller type distortion, where FeO$_6$ cages on the $xy$ plane elongate along $x$ and $y$ alternatively between neighboring Fe sites. Furthermore, we show that the rock-salt ordering of the Fe$^{5+}$ and Fe$^{3+}$ cations can be enhanced when the $B$-site dopants are arranged in a (111) plane due to a collective steric effect that facilitates the size discrepancy between the Fe$^{5+}$O$_6$ and Fe$^{3+}$O$_6$ octahedra and therefore gives rise to a larger band gap. The enhanced charge disproportionation in these solid solutions is verified by rigorously calculating the oxidation states of the Fe cations with different octahedral cage sizes. We therefore predict that the corresponding transition temperature will increase due to the enhanced charge ordering and larger band gap. The compositional, structural and electrical relationships exploited in this paper can be extended to a variety of perovskites and non-perovskite oxides providing guidance in structurally manipulating electrical properties of functional materials.