The design and preparation of porous materials with controlled structures and functionalities is crucial to a variety of absorption- or separation-relevant applications, including CO2 capture. Here, novel functional polymeric materials with three-dimensionally ordered macroporous (3DOM) structures are prepared by using colloidal crystals as templates using relatively simple, rapid, and inexpensive approaches. These ordered structures are used for the reversible CO2 capture from ambient air by humidity swing. Typically, the colloidal crystal template is synthesized from polymer latex particles of poly(methyl methacrylate) (PMMA) or polystyrene (PS). To maintain the functionality of the material, it is important to prevent the porous structure collapsing, which can occur by the hydrolysis of the ester bonds in conventional crosslinkers under basic conditions. This hydrolysis can be prevented by using a water-soluble crosslinker containing two quaternary ammonium moieties, which can be used to prepare stable porous crosslinked polymers with the monomer (vinylbenzyl)trimethylammonium chloride (VBTMACl) and using a PMMA-based colloidal crystal template. The hydroxide-containing monomer and dicationic crosslinker are synthesized from their chloride precursors, avoiding the ion-exchange step which causes shrinkage of the pores. An analysis of different methods for infiltrating the monomer solution into the colloidal crystal template shows that infiltration using capillary forces leads to fewer defects than infiltration under a partial vacuum. In addition, functional macroporous films with micrometer thickness are prepared from a template of PS-based colloidal crystals in a thin film. In general, the colloidal crystal templated materials showed improved CO2 absorption/desorption rates and swing sizes compared to a commercially available material with similar functional groups. This work could easily be extended to create a new generation of ordered macroporous polymeric materials with tunable functionalities for other applications.