Skip to content

Instantly share code, notes, and snippets.

@ericmann
Created March 26, 2013 14:28
Show Gist options
  • Save ericmann/5245768 to your computer and use it in GitHub Desktop.
Save ericmann/5245768 to your computer and use it in GitHub Desktop.
Three code snippets from my talk at the Portland WordPress User Group meetup on 3/25/2013
<?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' );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment