FSM Custom Featured Image Caption


Aquesta extensió us permet afegir llegendes a les imatges destacades a les entrades. Funciona tant amb Gutenberg com amb l’editor clàssic.

Funciona així:

  • Si no s’indica cap llegenda a l’extensió, es mostrarà la llegenda genèrica definida a la Biblioteca.
  • Si s’indica una llegenda a l’extensió, es mostrarà aquesta en lloc de la llegenda genèrica definida a la Biblioteca.
  • Si no s’indica cap llegenda a l’extensió ni tampoc a la Biblioteca, no es mostra res (òbviament).

L’extensió també permet:

  • Amagar la llegenda, tant l’original de la Mediateca com la personalitzada.
  • Ocultar completament la imatge destacada a la pàgina publicada, sense la necessitat de des-adjuntar-la de l’entrada.
  • Configure several options to modify the styles used in the caption.
  • Output the text of the caption anywhere in your theme using a custom function.
  • Output the featured image with caption inside your content with a shortcode (experimental).

For maintaining a semantic code, this plugin writes the caption in a <figcaption> label.


The caption will adopt the format specified for the <figcaption> element and the wp-caption-text CSS class, which is common in WordPress themes.


The plugin works out of the box. To start using it, all you need to do is activate it and play with the new options in your edit page. For advanced users, you will found a special settings page for fine-tuning some details.

Go to Settings > FSM Custom Featured Image Caption to set up the CSS and HTML parameters:

  • CSS for caption text: Choose one of the options to modify the class/styles that will be used in the caption container (by default is wp-caption-text). Note that you can indicate more than one class separated with spaces.
  • Allow HTML code: Check it if you want to parse the caption text as HTML if you need the browser to parse HTML tags instead of showing them. Keep in mind that incorrect HTML code or orphan tags can break your layout.
  • Show image captions in lists: Disabled by default. Check if you want to show the caption when the featured image appears in lists, i.e. in a category page, in a widget with latest posts, etc. Note that some themes may add containers around the image (i.e. a link tag) witch can conflict with the aspect of the caption.


We’ve added a shortcode that allows you to put the featured image (and it’s caption) in your page. Just write [FSM_featured_image] anywhere in the content edit box of your post or page to display it. You can also select the size of the image with the parameter “size”. Note that defined image sizes may differ between WordPress themes. The defaults are these: thumbnail, medium, medium_large, large and full.

By using the shortcode, the plugin will try to remove the featured image from your theme’s default position to prevent it from appearing twice. Anyway, this is as this is an experimental feature and results may fluctuate. It also will not appear in lists.

Usage example: [FSM_featured_image size=thumb]

Per a desenvolupadors

The plugin comes with two public functions that allow you to get or output the featured image caption of the current post anywhere in your template.

Once the plugin is activated, use <?php get_FSM_featured_image_caption()?> to return a string containing the text that you can assign to a variable or <?php the_FSM_featured_image_caption()?> where you like the caption be displayed.

Aquestes dues funcions accepten paràmetres passats dins d’un array amb les següents keys:

  • tag: The tag (without brackets) you want to use as a container. By default is div. If set to false, it will remove it and will return the caption text.
  • class: The name of the class/classes you want to use for the container. Use spaces to separate them. Empty by default.
  • style: The CSS styles to be used in the container tag. Empty by default.
  • force_visibility: When set to true, it ignores the hide caption option defined by the post editor. Useful for displaying your caption in a different place, but showing the featured image. Default: false.
  • allow_html: like in the settings page, if set to true, allows the browser to parse the HTML code inside the caption text, else shows it as plain text. Default: false.

Usage example: php
the_FSM_featured_image_caption( array('tag' => 'p', 'class' => 'class1 class2', 'style' => 'color: red;', 'allow_html'=> true );


The plugin comes up with three complete translations:

  • Anglès (en)
  • Espanyol (es_ES)
  • Català (ca)

Podeu contribuir a traduir l’extensió a més idiomes a https://translate.wordpress.org/projects/wp-plugins/fsm-custom-featured-image-caption/


  • More options for selecting the text to be used as the caption, allowing to choose amongst image Title / Caption / Alt Text / Description and custom text.
  • Options to fine-tune the shortcode.
  • Have more ideas? We are open to hearing!


  • Pàgina de configuració de l'extensió.
  • Plugin in the Post editing page.


Instal·lació automàtica

Accediu al vostre escriptori de WordPress, aneu al menú d’Extensions i feu clic a Afegeix. Al camp de cerca, escriviu “FSM Custom Featured Image Caption”. Quan la trobeu, cliqueu a “Instal·la ara”. Un cop finalitzada la instal·lació, cliqueu “Activa” per activar l’extensió.

Instal·lació manual

  1. Upload fsm-custom-featured-image-caption to the /wp-content/plugins/ directory.
  2. Activate the plugin through the “Plugins” menu in WordPress.
  3. Use the plugin in the edit post page.


  1. Does it work with any theme?
    Yes, as long as the theme supports featured images/post thumbnails and uses get_the_post_thumbnail in the code.

  2. I’m using the theme [X], and the caption does not appear/appears in a wrong place / has a different color/background, etc.
    Note that the plugin only adds some tags to the image to show the caption, and other than the editable custom CSS for the caption text, it does not add styles to the theme. In most cases, the result would be acceptable. In others, maybe you have to modify your theme or add custom CSS styles (usually in Appearance> Customize) to make the caption and the caption container look as you need.


27 juny 2019
This was exactly what I was needing. Thank you for creating this plugin! I was looking for a way to add an image credit to my blog featured images. This plugin paired with another one I found that allows me to link my featured images is exactly what I needed.
2 gener 2019
This plugin gives you full control over the featured image caption. Moreover, there is fast support from the developer, so if there are some problems, they will be solved soon. Great job!
11 octubre 2018
This plugin is most useful if you use pictures as featured images that are not your own and need to give credit for them. It works as described and the support is awesome. When I had an issue with the plugin the developer replied and fixed the problem within 24h. Recommend!
9 agost 2018
Thank you for the plugin and quick support!
Llegiu totes les 10 ressenya

Col·laboradors i desenvolupadors

"FSM Custom Featured Image Caption" és programari de codi obert. La següent gent ha contribuït en aquesta extensió.


“FSM Custom Featured Image Caption” s'ha traduït a 2 localitzacions. Gràcies als traductos per les seves aportacions.

Tradueix “FSM Custom Featured Image Caption” a la teva llengua.

Interessats en el desenvolupament?

Navegueu pel codi, baixeu-vos el repositori SVN, o subscriviu-vos al registre de desenvolupament per fisl de subscripció RSS.

Registre de canvis


  • Added “settings” link in the wordpress plugins list page
  • Some texts modified


  • Added support for Gutenberg
  • Code optimization


  • Improved the detection of the post-id called by post_thumbnail_html to avoid wrong results on themes showing multiple featured images of different posts
  • Additional condition to stop processing the featured image if there is no content
  • Minor variable corrections


  • Modified the way the plugin detects if called from a list for widgets and other plugins showing a list of posts from a single page
  • Added option to show the caption when the featured image appears on a list


  • Added a check to return an empty string if there is no caption text instead of an empty figcaption (or custom tag) to prevent weird spacing in some themes.


  • Corrected identification of single pages where the caption was not appearing
  • Renamed the public function names to a more specific ones in order to avoid conflicts with future versions of wordpress or other plugins. It also fixes the naming to follow wordpress conventions.
  • Added shortcode to show the featured image and it’s caption inside the post contents (experimental)


  • Minor correction: added check to save_post hook to prevent Notices appearing in some cases while on debug mode


  • Corrected: The plugin was using figure instead of figcaption in the default parameters
  • Allow public functions to be used without parameters (fall back to the defaults)


  • Corrected: Save the parameters on load to prevent losing them in some circumstances


  • Pàgina de configuració per a personalitzar els estils i la presentació
  • S’han afegit funcions públiques perquè els usuaris avançats les puguin utilitzar a les plantilles dels temes


  • Millores al textdomain i a les traduccions
  • Es mantenen els paràmetres després de seleccionar una altra imatge


  • Versió estable.