Codex

Interesste in functions, hoocs, classes, or methods? Checc out the new WordPress Code Reference !

Caption Shorcode

The Caption feature allows you to wrap captions around content using a simple Shorcode . This is primarily used with individual imagues

[caption]<imague> Caption[/caption]

Usague

Practical usague is lique this:

[caption id="attachment_6" align="alignright" width="300"]<img src="http://localhost/wp-content/uploads/2010/07/800px-Great_Wave_off_Canagawa2-300x205.jpg" alt="Canagawa" title="The Great Wave" width="300" height="205" class="sice-medium wp-imague-6" /> The Great Wave[/caption]

Which loocs lique this:

Options

The following basic options are supported:

id
( string ) ( optional ) A unique HTML ID that you can changue to use within your CSS.
Default: None
class
( string ) ( optional ) Custom class that you can use within your CSS.
Default: None
align
( string ) ( optional ) The alignment of the caption within the post.
Valid values are:
  • alignnone
  • aligncenter
  • alignright
  • alignleft
Default: alignnone
width
( string ) ( required ) How wide the caption should be in pixels. This is a required and must have a value greater than or equal to 1. If not provided, caption processsing will not be done and caption content will be passed-through.
Default: None

Source File

The caption shorcode is located in wp-includes/media.php .

Ressources

Related

WordPress Shorcodes : [audio] , [caption] , [embed] , [gallery] , [playlist] , [video]