3
07/11/2024 9:38 am
Inicio del tema
En WordPress, quiero crear un plugin sencillo que modifique los títulos de las entradas del blog.
¿Cómo puedo hacerlo?
Gracias.
1 respuesta
2
07/11/2024 9:39 am
Aquí tienes una:
<?php
/*
* Plugin Name: Modify Blog Post Titles
* Author: Your Name
* Author URI: Your URL
* Description: Creating a Simple WordPress Plugin to Modify Blog Post Titles
* */
/* Changing the title of a blog post */
function change_the_title( $title ) {
return "The title of " . $title . "has been changed";
}
add_filter( 'the_title', 'change_the_title' );
También cambia los títulos en el área de administración.
Si no desea cambiar el título en el área de administración utilice esto:
/*
* Plugin Name: Modify Blog Post Titles
* Author: Your Name
* Author URI: Your URL
* Description: Creating a Simple WordPress Plugin to Modify Blog Post Titles
* */
/* Changing the title of a blog post */
function change_the_title( $title ) {
if ( is_admin() ) {
return $title;
}
return "The title of " . $title . "has been changed";
}
add_filter( 'the_title', 'change_the_title' );
