Posts Tagged ‘functions.php’

All posts tagged functions.php.

Easily Add Page Excerpts in WordPress

1

Posted by: Jennifer Zelazny on August 9, 2011

Categorized: HOWTOs, WordPress

Tagged: , , ,

Ever need to add an excerpt field for WordPress when working with pages? There is an easy, one line way to do this (no plugin needed). Simply add this to your theme’s functions.php file:

add_post_type_support( 'page', 'excerpt' );

Once you have that in place – you can then use the WordPress the_excerpt() function to show the excerpt within the theme.

Remove “Private:” From WordPress Titles

41

Posted by: Jennifer Zelazny on January 14, 2008

Categorized: WordPress, WordPress Logic

Tagged: , ,

I needed to be able filter out the text “Private:” for posts and pages that were password protected but did not want to edit any core WordPress files. To filter out that text, I added the following code into my functions.php file (within my theme directory):

function remove_private_prefix($title) {
$title = str_replace(
'Private:',
'',
$title);
return $title;
}
add_filter('the_title','remove_private_prefix');

(I also posted this filter in the WordPress Support Forum)