Responsive Meta Tag

If you are building a theme that you’d like to be mobile responsive, it is important that you add this meta tag to the <head> section of your site so mobile phones know to render it appropriately.

If you are using the Genesis theme framework, you can add this to your theme instead: add_theme_support( 'genesis-responsive-viewport' );

<?php
/**
* Viewport Meta Tag for Mobile Browsers
*
* @author Bill Erickson
* @link http://www.billerickson.net/code/responsive-meta-tag
*/
function be_viewport_meta_tag() {
echo '<meta name="viewport" content="width=device-width, initial-scale=1.0"/>';
}
add_action( 'wp_head', 'be_viewport_meta_tag' );
view raw functions.php hosted with ❤ by GitHub

Bill Erickson

Bill Erickson is the co-founder and lead developer at CultivateWP, a WordPress agency focusing on high performance sites for web publishers.

About Me
Ready to upgrade your website?

I build custom WordPress websites that look great and are easy to manage.

Let's Talk