Adding the NextPage Button Back to the Toolbar

There’s a convenient button for the <!--more--> tag on the toolbar, but nothing for the <!--nextpage--> quicktag. Fix that with this

add_filter('mce_buttons','add_nextpage_button');
function add_nextpage_button($buttons) {
    //array_splice so we can insert the new item without overwriting an existing button
    array_splice($buttons, 15,0, 'wp_page' );
    return $buttons;
}

Append to Content

If you need to auto-append information to the end of your page/post content, there’s an easier way to do it than editing your theme.

add_filter( 'the_content', 'append_to_content' );
function append_to_content($content) {
	global $post;
	//if you want to restrict this to a specific post type
	if (get_post_type($post) == 'post') {
		$content .= '<p style="text-align:center;">***</p>';
	}
	return $content;
}

Can be especially useful for auto-appending custom field information

Add Featured Image Thumbnail to Posts Page

Customize the information that is displayed on the ‘posts’ page

Adding a column labeled “Thumbnail” (and delete the “Comments” column).

add_filter( 'manage_edit-post_columns', 'set_columns' );
function set_columns($columns) {
	$columns['thumbnail'] = 'Thumbnail';
	unset( $columns['comments'] );
	return $columns;
}

Now we need to tell WordPress what to do with this new “Thumbnail” space. Here, we’re checking for the existence of a featured image and displaying it, or noting that there is no thumbnail.

add_action( 'manage_posts_custom_column', 'fill_columns' );
function fill_columns($column) {
	global $post;
	switch($column) {
		case 'thumbnail' :
			if (has_post_thumbnail($post->ID))
				echo get_the_post_thumbnail($post->ID, array(50, 50));
			else
				echo '<em>no thumbnail</em>';
		break;
	}
}

Customize the Favorites Menu

Ever use that favorites menu up by the “Howdy” greeting? I never really did until I started customizing the options.

One of my favorites is adding a link to the master options page (wp-admin/options.php)

add_filter('favorite_actions', 'custom_favorites');
function custom_favorites($actions) {
		$actions['options.php'] = array('All Settings', 'unfiltered_html'); // this line adds an item
		return $actions;
}

Or, remove the menu entirely

add_filter('favorite_actions', 'remove_favorites');
function remove_favorites($actions) {
		$actions = array(); 
		return $actions;
}

Add More Date/Time Format Options

If you find that you need to offer some non-standard date or time formats to the general settings page, this will help.

add_filter('date_formats', 'add_date_format');
function add_date_format($original) {
        $more = array('D, M jS, Y');
        return array_merge($original, $more);
                        
}

add_filter('time_formats', 'add_time_format');
function add_time_format($original) {
        $more = array('H:i:s a');
        return array_merge($original, $more);
                        
}

Remove “Generator” Tags

Don’t want those “generator” tags in your source? Add this

remove_action( 'wp_head', 'wp_generator' );

To modify the output, you can run in through a filter. In this case, the modification is removal.

add_filter('the_generator', 'remove_generated_by');
function remove_generated_by($footer_text) {
    return '';
}

If you want to be more specific about where the generator tags are are removed, you can change the filter to something like on of these

add_filter('get_the_generator_xhtml', 'remove_generated_by');

Just swap ‘xhtml’ for one of the following as needed: html, xhtml, atom, rss2, rdf, comment, export.

Change Block Format Dropdown in the Visual Editor

Have clients that insist on using <h1> tags throughout their posts? Can’t remember the last time you used the <address> tag? This can help you clean up that block format dropdown menu.

add_filter('tiny_mce_before_init', 'change_mce_dropdown' );
function change_mce_dropdown( $initArray ) {
	$initArray['theme_advanced_blockformats'] = 'p,h3,h4,h5,h6,pre';
	return $initArray;
}