Last active
January 7, 2018 22:04
-
-
Save TutorialWordPress/cc52349eff1f5ceb065bb60e5284e3c4 to your computer and use it in GitHub Desktop.
WPTutorial Shortcode:: Añadir año automáticamente
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Shortcode para añadir el año automáticamente en tus publicaciones | |
// [year] | |
function wptutorial_year_shortcode() { // Nombre del shortcode | |
$year = date('Y'); // Código o funcionalidad | |
return $year; | |
} | |
add_shortcode('year', 'wptutorial_year_shortcode'); // Registramos el shortcode para poder usarlo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Usando este código y el shortcode [year] en tus publicaciones podrás conseguir que el año se actualice automáticamente sin necesidad de cambiar nada, consiguiendo así que tu contenido esté siempre actualizado de cara a tus lectores.
En WPTutorial.online tienes toda la información sobre los shortcodes de WordPress