Editing Photo Caption Alignment

Hello! I’m using the Christie theme for my manuscript, which I love. What I’m trying to figure out is how to center the photo captions. The photos in my Photos chapter are all centered on the page, but the caption text comes out left-aligned. I started experimenting with the Custom Styles option but stopped because I don’t want to “ruin” my other chapters. Is there a way to center the caption text without using Custom Styles? Thank you!

I am replying here just to bump up this question because I have experienced the same problem. It would be great if this worked by default.

There isn’t a way to fix this without custom code. Try using the following code in your Appearance/Custom Styles/Your Web Styles area. It won’t ruin anything else. If for some reason it doesn’t do what it is supposed to do, just delete it. It’s non-destructive.

.front-matter .wp-caption figcaption, .part .wp-caption figcaption, .chapter .wp-caption figcaption, .back-matter .wp-caption figcaption, .front-matter .wp-caption .wp-caption-text, .part .wp-caption .wp-caption-text, .chapter .wp-caption .wp-caption-text, .back-matter .wp-caption .wp-caption-text .front-matter .wp-caption.alignright figcaption, .part .wp-caption.alignright figcaption, .chapter .wp-caption.alignright figcaption, .back-matter .wp-caption.alignright figcaption, .front-matter .wp-nocaption.alignright figcaption, .part .wp-nocaption.alignright figcaption, .chapter .wp-nocaption.alignright figcaption, .back-matter .wp-nocaption.alignright figcaption, .front-matter .wp-caption.alignright .wp-caption-text, .part .wp-caption.alignright .wp-caption-text, .chapter .wp-caption.alignright .wp-caption-text, .back-matter .wp-caption.alignright .wp-caption-text, .front-matter .wp-nocaption.alignright .wp-caption-text, .part .wp-nocaption.alignright .wp-caption-text, .chapter .wp-nocaption.alignright .wp-caption-text, .back-matter .wp-nocaption.alignright .wp-caption-text {
text-align: center !important;
}

To add to the discussion, you could use a custom class if you don’t want to center all captions:

.centercap {
display: block;
text-align: center;
}

…then use [caption]< a>image< /a> < span class=“centercap”>Caption text< /span>[/caption]

Is there a way to center the caption text without using Custom Styles?

Without custom styles, you’d have to do it inline:
[caption]< a>image< /a> < span style=“display: block; text-align: center;”>Caption text< /span>[/caption]

…but using custom styles is the way to go.


With the way the caption shortcode formats, you should use < div> instead of < span> and then you can ignore the display: block. Using < span> with the display: block is inelegant, but thought it demonstrated the formatting well for the specific example.

Thank you weevie833 and lanemark for your replies! I tried weevie833’s long code and that, unfortunately, didn’t change anything. Lanemark, you have two codes in the first part of your post. Should they both be entered in the Your Web Styles area? And what exactly is inline?

Inline is changing the styling without using custom styles, as it was the question you asked. I would avoid this, though, and use the custom styles.

weevie833’s code should work if you paste it into Appearance > Custom Styles > Your Web Styles. If the captions aren’t centered after doing that, you may have something else going on.

Thank you lanemark! I’m halfway there using weevie833’s code. The caption text is all nicely centered when I “Visit Book.” When I export the manuscript, however, the caption text is once again all left-aligned. Hmmm.

Pasting to “Your Web Styles” will only affect how it displays in the web version. On the Custom Styles page, there’s a drop-down at the top of the screen for Web, Ebook, PDF. The custom css will need to be repasted for the appropriate export format.

The custom code is for Web version. If you go to Custom Styles and change the mode to PDF (it’s on Web by default), then paste the same code in the “Your PDF Styles” area, it might change the alignment upon export. The same goes for the e-book custom styles in the same area.

And maybe I should change my screen name to my actual name (Steve Covello) instead of the nickname my grandmother gave me as a 4 year old (sans the number).

Thank you so much for your help, Steve (weevie833) and lanemark!! The photo captions are now perfectly centered in my pdf export!