A unified process for the construction of hierarchical conforming bases on a range of element types is proposed based on an ab initio preservation of the underlying cohomology. This process supports not only the most common simplicial element types, as are now well known, but is generalized to squares, hexahedra, prisms and importantly pyramids. Whilst these latter cases have received (to varying degrees) attention in the literature, their foundation is less well developed than for the simplicial case. The generalization discussed in this paper is effected by recourse to basic ideas from algebraic topology (differential forms, homology, cohomology, etc) and as such extends the fundamental theoretical framework established by the work of Hiptmair and Arnold et al. for simplices. The process of forming hierarchical bases involves a recursive orthogonalization and it is shown that the resulting finite element mass, quasi-stiffness and composite matrices exhibit exponential or better growth in condition number.