The $p_{\rm T}$-differential production cross sections of the prompt (B feed-down subtracted) charmed mesons D$^0$, D$^+$, and D$^{*+}$ in the rapidity range $|y|<0.5$, and for transverse momentum $1< p_{\rm T} <12$ GeV/$c$, were measured in proton-proton collisions at $\sqrt{s} = 2.76$ TeV with the ALICE detector at the Large Hadron Collider. The analysis exploited the hadronic decays D$^0 \rightarrow $K$\pi$, D$^+ \rightarrow $K$\pi\pi$, D$^{*+} \rightarrow $D$^0\pi$, and their charge conjugates, and was performed on a $L_{\rm int} = 1.1$ nb$^{-1}$ event sample collected in 2011 with a minimum-bias trigger. The total charm production cross section at $\sqrt{s} = 2.76$ TeV and at 7 TeV was evaluated by extrapolating to the full phase space the $p_{\rm T}$-differential production cross sections at $\sqrt{s} = 2.76$ TeV and our previous measurements at $\sqrt{s} = 7$ TeV. The results were compared to existing measurements and to perturbative-QCD calculations. The fraction of cdbar D mesons produced in a vector state was also determined.