Este plugin no se ha probado con las últimas 3 versiones mayores de WordPress. Puede que ya no tenga soporte ni lo mantenga nadie, o puede que tenga problemas de compatibilidad cuando se usa con las versiones más recientes de WordPress.

FSM Custom Featured Image Caption

Descripción

Este plugin permite añadir una leyenda personalizada a la imagen destacada de un post. Funciona de la siguiente manera:

  • Si no se indica ninguna leyenda en el plugin, se mostrará la leyenda genérica definida en la Biblioteca.
  • Si se indica una leyenda en el plugin, se mostrará esta en lugar de la leyenda genérica definida en la Biblioteca.
  • Si no se indica ninguna leyenda en el plugin ni tampoco en la Biblioteca, no se muestra nada (obviamente).

Este plugin también te permite:

  • Hide the caption, either the original from the Media Library or the custom one.
  • Entirely hide the featured image in the public view, without having to de-attach it from the post.
  • 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)

Este plugin escribe la leyenda en la etiqueta <figcaption> para mantener la correcta semántica del código fuente.

Formato

La leyenda adopta el formato especificado para el elemento <figcaption> y la clase CSS wp-caption-text, las habituales en los temas de WordPress.

Usage

By default the plugin just works. All you should need to do in order to begin using it is activate it and use the new added options in the featured image section of your edit page. However, there is a settings page for advanced users that allows you to customize it to your needs.
Visit ‘Settings > FSM Custom Featured Image Caption’ to setup 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 separating it with a space
  • 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 (i.e. «Photo by John Doe«). Have in mind that incorrect html code or orphan tags can break your layout
  • Show image captions in lists: Check if you want to show the caption when the featured image appears in a list, i.e. in a category page, in a widget showing the latests posts, etc. Disabled by default. Note that some themes may add containers around the image (i.e. a link tag) that can interfere with the correct presentation of the caption

Shortcode

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 and it will appear. 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 being: thumbnail, medium, medium_large, large and full.

When you use the shortcode, the plugin will try to remove the featured image from your theme’s default position (so it doesn’t appears twice, but as this is an experimental feature, results may vary. It also will not appear in lists

Usage example
[FSM_featured_image size=thumb]

For developers

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’d like the caption to be displayed.

Both functions accept parameters passed inside an array with the following 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 just return the caption text
  • class: The name of the class/classes you want to use for the container. Use space 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 set by the post editor. It can be useful when you want your caption in a different place but still show the featured image. Deafult: false
  • allow_html: as 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 );

Traducciones

El plugin incorpora 3 traducciones completas:

  • Inglés (en)
  • Español (es_ES)
  • Catalán (ca)

Próximamente

  • Más opciones para seleccionar el texto que se va a utilizar como leyenda, permitiendo elegir entre el título, la leyenda, el texto alt o la descripción de la imagen. O un texto totalmente personalizado.
  • Options to fine tune the shortcode.
  • ¿Tienes más ideas? ¡Queremos oírlas!

Capturas

  • Página de configuración del plugin.
  • El plugin en la página de edición de entradas.

Instalación

  1. Sube fsm-custom-featured-image-caption a la carpeta /wp-content/plugins/
  2. Activa el plugin en la opción ‘Plugins’ del menú de WordPress
  3. Puedes utilizar el plugin en la página de edición de entradas.

Preguntas frecuentes

  1. ¿Funciona con cualquier tema?
    Sí, siempre y cuando el tema sea compatible con imágenes destacadas y use get_the_post_thumbnail en el código.

  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 in order 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 and in others you are required 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.

Reseñas

junio 27, 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.
enero 2, 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!
octubre 11, 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!
agosto 9, 2018
Thank you for the plugin and quick support!
julio 26, 2018
This plugin is just what I need to display featured image captions so I can properly give credit to my image sources (even though I'll be using mostly free images). I like the "Allow HTML code" option in the plugin's settings page so I can even link back to an image source directly in the caption. The support for this plugin is great too. Plugin author Fesomia was responsive and quick to troubleshoot an issue I had with the caption not wrapping properly on smaller screens (easily resolved with just a minor CSS fix which you can read about in the support forum for this plugin). Keep up the great work, Fesomia, and look forward to further updates to this already useful plugin!
Leer todas las 10 reseñas

Colaboradores y desarrolladores

“FSM Custom Featured Image Caption” es un software de código abierto. Las siguientes personas han colaborado con este plugin.

Colaboradores

“FSM Custom Featured Image Caption” ha sido traducido a 2 idiomas locales. Gracias a los traductores por sus contribuciones.

Traduce “FSM Custom Featured Image Caption” a tu idioma.

¿Interesado en el desarrollo?

Revisa el código , echa un vistazo al repositorio SVN o suscríbete al registro de desarrollo por RSS.

Registro de cambios

1.17

  • 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

1.16

  • 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

1.15

  • 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.

1.14

  • 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)

1.13

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

1.12

  • 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)

1.11

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

1.10

  • Nueva página de ajustes para personalizar los estilos y la presentación
  • Se han añadido funciones públicas para que los usuarios avanzados las puedan utilizar dentro de las plantillas del tema

1.01

  • Mejoras en el textdomain y en las traducciones
  • Se mantienen los parámetros después de seleccionar otra imagen.

1.0

  • Versión estable.