MonthApril 2013

Remove extra header tags

WordPress generates a handful of <meta> tags that are not always used by a theme, so here’s a trick to remove some or all of them:

/**
* code #5 - removes excess WordPress header tags from default themes. 
* feel free to customize the options to suit your own needs.
*/
function clean_wp_header() {
	remove_action('wp_head', 'wp_generator');
	remove_action('wp_head', 'rel_canonical');
	remove_action('wp_head', 'rsd_link');
	remove_action('wp_head', 'feed_links',2);
	remove_action('wp_head', 'feed_links_extra',3);
	remove_action('wp_head', 'wlwmanifest_link');
	remove_action('wp_head', 'wp_shortlink_wp_head', 10, 0);
	remove_action('wp_head', 'adjacent_posts_rel_link_wp_head', 10, 0);
}
add_action('init', 'clean_wp_header');

There’s more of it in this collection.

Check for retina via javascript

Retina displays can lead to all sorts of new things you can do, some of them headache–inducing. Detecting for retina devices or hi–density displays still isn’t a straightforward thing, but this javascript snippet could come handy for a quick hack:

if((window.devicePixelRatio===undefined?1:window.devicePixelRatio)>1)
    // do something here

More details on this technique from Shaun Inman’s post.

© 2017 builder2

Theme by Anders NorénUp ↑

Follow

Get every new post delivered to your Inbox

Join other followers: