We describe a general method to model multicomponent ordered crystals using the phase-field crystal (PFC) formalism. As a test case, a generic B2 compound is investigated. We are able to produce a line of either first-order or second-order order-disorder phase transitions, features that have not been incorporated in existing PFC approaches. Further, it is found that the only elastic constant for B2 that depends on ordering is $C_{11}$. This B2 model was then used to study antiphase boundaries (APBs). The APBs were shown to reproduce classical mean field results. Dynamical simulations of ordering across small-angle grain boundaries predict that dislocation cores pin the evolution of APBs.