Quero um plugin WordPress simples para modificar os títulos das publicações do blogue

  

3
Início do tópico

No WordPress, pretendo criar um plugin simples que modifica os títulos das mensagens do blogue.

Como é que posso fazer isto?

Obrigado!

1 Resposta
2

Aqui está uma:

<?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' );

Também altera os títulos na área de administração. 

Se não pretender alterar o título na área de administração, utilize isto: 

/*
 * 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' );
Partilhar: