# Captions for videos formatted like the captions for images

**URL:** <https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163>\
**Category:** Developer Questions\
**Created:** [November 11, 2019, 8:59pm UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163 "2019-11-11T20:59:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [November 11, 2019, 8:59pm UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163/1 "2019-11-11T20:59:53Z")

</div>

Hi Everyone,

I would like to insert captions for the videos I upload to my book, and have them formatted just like the captions for the images.

When I insert a video, the caption is not inserted, even if the video does have a caption in the media library. Once inserted, if I click on it to edit it, there is no field to insert a caption (in contrast with what happens with the images).

I have tried to do it via HTML. Captions for images seem to be inside the HTML tag figcaption and with the class wp-caption-text, i.e.

`<figcaption class="wp-caption-text">...</figcaption>`

But I have not been able to use the tag in the editor, and using just the class “wp-caption-text” for e.g. the tag `<p>` does not give the same result.

Any ideas?

Thanks a lot,  
Luis

---

<div class="post-metadata">

**Author:** ![SteelWagstaff](https://pressbooks.community/user_avatar/pressbooks.community/steelwagstaff/32/1280_2.png) [@SteelWagstaff](https://pressbooks.community/u/SteelWagstaff)\
**Post date:** [November 12, 2019, 4:38pm UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163/2 "2019-11-12T16:38:16Z")

</div>

Hi Luis,

It sounds like what you’re describing is adding a caption for a video element, not captions/subtitles for the video file itself. I don’t think I’ve ever seen this as a feature request/issue in Pressbooks before. In part I think this is because the spec for captions defines a caption as a description of a still image, not moving ones (as you’d get in video). For more on captions/subtitles for videos, see [https://github.com/WordPress/gutenberg/issues/7673#issuecomment-405080772](https://github.com/WordPress/gutenberg/issues/7673#issuecomment-405080772) or [https://developer.mozilla.org/en-US/docs/Web/Guide/Audio\_and\_video\_delivery/Adding\_captions\_and\_subtitles\_to\_HTML5\_video](https://developer.mozilla.org/en-US/docs/Web/Guide/Audio_and_video_delivery/Adding_captions_and_subtitles_to_HTML5_video).

If you’d like to display a ‘caption’ or description of the video below the player, like you would with a still image, perhaps you could try using the caption shortcode as described here: [http://justintadlock.com/archives/2011/07/01/captions-in-wordpress](http://justintadlock.com/archives/2011/07/01/captions-in-wordpress). I suspect that the captions themselves won’t be styled as you’d expect for this use case, because the shortcode is intended to work with image captions, but could perhaps be fixed with a bit of CSS. Don’t know what will happen in export formats yet, but I’d be curious to find out more. If you notice anything buggy or want to file a feature request to improve this, you’re always welcome to write something up for us in our ideas repo: [https://github.com/pressbooks/ideas](https://github.com/pressbooks/ideas)

---

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [November 14, 2019, 6:19pm UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163/3 "2019-11-14T18:19:48Z")

</div>

Thank you so much Steel,  
As you guessed, I wanted to display a description of the video below the player. I could not manage to make the method explained at the [justintadlock.com](http://justintadlock.com) site work because Pressbooks did not like the shortcode [caption] inside [video].

My temporary fix is to mimic the classes that image captions have, i.e:

> ```
> <div class="chapter" style="max-width: 700px; margin: auto;">
> <div class="wp-caption aligncenter">
> <div class="wp-caption-text">
> My caption
> </div></div></div>
> 
> ```

If I come up with something more elegant, I’ll let you know.  
Thanks a lot for your help  
Luis

---

<div class="post-metadata">

**Author:** ![lrizquierdo](https://pressbooks.community/user_avatar/pressbooks.community/lrizquierdo/32/870_2.png) [@lrizquierdo](https://pressbooks.community/u/lrizquierdo)\
**Post date:** [November 21, 2019, 11:09am UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163/4 "2019-11-21T11:09:07Z")

</div>

I ended up submitting this request to the ideas repo:

> <https://github.com/pressbooks/ideas/issues/233>
>
> Feature Description
> I'd like to be able to insert a caption for uploaded videos (i.e. a description of the video below the...

---

<div class="post-metadata">

**Author:** ![creigmalta](https://pressbooks.community/letter_avatar_proxy/v4/letter/c/c5a1d2/32.png) [@creigmalta](https://pressbooks.community/u/creigmalta)\
**Post date:** [October 19, 2021, 6:14pm UTC](https://pressbooks.community/t/captions-for-videos-formatted-like-the-captions-for-images/1163/5 "2021-10-19T18:14:35Z")

</div>

Make captions automatically appear for an embedded video by adding “&cc\_load\_policy=1” to the video’s embed code.

You can also choose a caption language for the embedded [youtube](http://net-informations.com/q/mis/youtube.html) video. To specify the caption language for the video that you’d like to embed, just add “&cc\_lang\_pref=fr&cc\_load\_policy=1” to the video’s embed code.

“cc\_lang\_pref” sets the language for the captions shown in the video.  
“cc\_load\_policy=1” turns captions on by default.  
“fr” represents the language code for French. You can look up 2-letter language codes in the ISO 639-1 standard.
