In this work, we provide consistent compactifications of Einstein-Maxwell and Einstein-Maxwell-Lovelock theories on direct product spacetimes of the form M D = M d × K p , where K p is a Euclidean internal manifold of constant curvature. For these compactifications to take place, it is required the distribution of a precise flux of p-forms over the internal manifold. The dynamic of the p-forms are demanded to be controlled by two types of interaction. First, by specific couplings with the curvature tensor and, second, by a suitable interaction with the electromagnetic field of the d-dimensional brane, the latter being dictated by a modification of the recently proposed theory of Quasitopological Electromagnetism. The field equations of the corresponding compactified theories, which are of second order, are solved and general homogenous charged black p-branes are constructed. We explicitly provide homogenous Reissner-Nordström black strings and black p-branes in Einstein-Maxwell theory and homogenous charged Boulware-Deser black p-branes for quadratic and cubic Maxwell-Lovelock gravities.