public
Created

Three code snippets from my talk at the Portland WordPress User Group meetup on 3/25/2013

  • Download Gist
gistfile1.php
PHP
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
<?php
/**
* Custom Hacks for PDXWP Meetup
*/
 
/**
* Clean up the output of the <head> block
*/
function pdxwp_clean_header() {
remove_action( 'wp_head', 'feed_links_extra', 3 ); // Display the links to the extra feeds such as category feeds
remove_action( 'wp_head', 'feed_links', 2 ); // Display the links to the general feeds: Post and Comment Feed
remove_action( 'wp_head', 'rsd_link' ); // Display the link to the Really Simple Discovery service endpoint, EditURI link
remove_action( 'wp_head', 'wlwmanifest_link' ); // Display the link to the Windows Live Writer manifest file.
remove_action( 'wp_head', 'index_rel_link' ); // index link
remove_action( 'wp_head', 'wp_generator' ); // Display the XHTML generator that is generated on the wp_head hook, WP version
}
add_action( 'init', 'pdxwp_clean_header' );
/**
* Rename 'posts' to 'articles'
*/
function pdxwp_posts_to_articles( $translated ) {
$words = array(
// 'word to translate' = > 'translation'
'Posts' => 'Articles',
'Post' => 'Article',
);
 
$translated = str_ireplace( array_keys( $words ), $words, $translated );
 
return $translated;
}
add_filter( 'gettext', 'pdxwp_posts_to_articles' );
add_filter( 'ngettext', 'pdxwp_posts_to_articles' );
add_filter( 'gettext_with_context', 'pdxwp_posts_to_articles' );
 
/**
* Add Pinterest to contact information
*/
function pdxwp_add_pinterest( $contact_methods ) {
if ( ! isset( $contact_methods['pinterest'] ) ) {
$contact_methods['pinterest'] = 'Pinterest';
}
return $contact_methods;
}
add_filter( 'user_contactmethods', 'pdxwp_add_pinterest' );

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.