Añade subtítulos a tus páginas, entradas o tipos de contenido personalizados.
Calificaciones
4.1
Última actualización
April 23, 2024
Versión
3.4.1
Instalaciones activas
10K
WP Subtitle

El plugin WP Subtitle permite que tus páginas y entradas contengan un subtítulo. Esta línea de texto corto generalmente debe aparecer debajo del título de una entrada (o página), pero la puedes insertar en tu plantilla donde quieras.

The subtitle can be inserted into your theme template files (or plugin) using the following API:

Mostrar el subtítulo

All parameters are optional. If ‘post_id’ is omitted then the current post ID in the loop is used.

Código PHP:

do_action( 'plugins/wp_subtitle/the_subtitle', array( 'before' => '<p class="subtitle">', 'after' => '</p>', 'post_id' => get_the_ID(), 'default_value' => '' ) );

Output:

<p class="subtitle">My Post Subtitle</p>

Obtener el subtítulo

All parameters are optional. If ‘post_id’ is omitted then the current post ID in the loop is used.

A default value can be supplied as the second parameter for apply_filters. This will be used if the post does not have a subtitle. Leave as an empty string to return an empty string if the post does not have a subtitle.

Código PHP:

$subtitle = apply_filters( 'plugins/wp_subtitle/get_subtitle', '', array( 'before' => '<p class="subtitle">', 'after' => '</p>', 'post_id' => get_the_ID() ) );

Resultado:

$subtitle = '<p class="subtitle">My Post Subtitle</p>'

Parámetros

The array of arguments accepted for the plugins/wp_subtitle/the_subtitle action and plugins/wp_subtitle/get_subtitle filter are:

before (string) Text to place before the subtitle if one exists. Defaults to an empty string.

after (string) Text to place after the subtitle if one exists. Defaults to to an empty string.

post_id (integer) Post, page or custom post type ID.

default_value (string) Only used by the plugins/wp_subtitle/the_subtitle action, allows you to specify a default subtitle to display if the post does not have one. For the plugins/wp_subtitle/get_subtitle filter the second parameter of apply_filters should be used instead. Defaults to to an empty string.

Compatible con tipos de contenido

By default, subtitle are supported by both posts and pages. To add support for custom post types add teh following to your theme functions file or plugin:

add_post_type_support( 'my_post_type', 'wps_subtitle' )

WooCommerce Plugin Support

Subtitles can automatically be added to your WooCommerce products without needing to make template changes. In the admin go to WooCommerce > Settings > Products where you can choose to:

  • Enable Product Subtitles
  • Display the subtitle on single product pages
  • Display the subtitle on product archives (category pages)

Yoast SEO and SEOPress Plugin Support

The plugin allows you to include the subtitle in your meta titles and descriptions via the Yoast SEO and SEOPress plugins.

Similar to the Yoast %%title%% placeholder which inserts the post title, you can use %%wps_subtitle%%.

There are also addition placeholders and filters to allow to to customize seperators for the subtitle.

For more information, view the SEO support documentation here.

Instalaciones activas
10K
Probado hasta
6.5.5
Te puedes descargar este plugin para utilizarlo en tu instalación autoalojada de WordPress.