Ich möchte ein einfaches WordPress-Plugin zum Ändern von Blogpost-Titeln

  

3
Themenstarter

In WordPress möchte ich ein einfaches Plugin erstellen, das die Titel von Blogbeiträgen ändert.

Wie kann ich das tun?

Danke!

1 Antwort
2

Hier ist eine:

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

Es ändert auch die Titel im Adminbereich. 

Wenn Sie den Titel nicht im Verwaltungsbereich ändern möchten, verwenden Sie diese Option: 

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