Return to Snippet

Revision: 39401
at August 19, 2011 23:19 by silentpro


Updated Code
/* REPLACE PROTECTED-PRIVATE POSTS */

function the_title_trim($title) {
	// Might aswell make use of this function to escape attributes
	$title = attribute_escape($title);
	// What to find in the title
	$findthese = array(
		'#Protected:#', // # is just the delimeter
		'#Private:#'
	);
	// What to replace it with
	$replacewith = array(
		'a', // What to replace protected with
		'b' // What to replace private with
	);
	// Items replace by array key
	$title = preg_replace($findthese, $replacewith, $title);
	return $title;
}
add_filter('the_title', 'the_title_trim');

Revision: 39400
at January 17, 2011 17:01 by silentpro


Initial Code
/* REPLACE PROTECTED-PRIVATE POSTS */

function the_title_trim($title) {
	// Might aswell make use of this function to escape attributes
	$title = attribute_escape($title);
	// What to find in the title
	$findthese = array(
		'#Protected:#', // # is just the delimeter
		'#Private:#'
	);
	// What to replace it with
	$replacewith = array(
		'a', // What to replace protected with
		'b' // What to replace private with
	);
	// Items replace by array key
	$title = preg_replace($findthese, $replacewith, $title);
	return $title;
}
add_filter('the_title', 'the_title_trim');

Initial URL

                                

Initial Description
WP Functions.

Initial Title
Replace Protected-Private Posts

Initial Tags
php, textmate, wordpress

Initial Language
PHP