Custom Viewport Tag

This tutorial will show you how to remove the default theme viewport tag and insert your custom viewport tag. The custom viewport tag in this tutorial will enable zooming on mobile devices.

  • first create a custom-functions.php file (if it doesn't exist in the theme folder)
  • if you already have the custom-functions.php file, merge the PHP code without the <?php ?> wrap
  • paste in the code below:

<?php 

	// remove theme viewport tag first
	remove_action('wp_head', 'themify_viewport_tag'); 
	
	// add custom viewport tag
	function themify_custom_viewport_tag() { 
		echo '<meta name="viewport" content="width=device-width, initial-scale=1">'; 
	};
	add_action( 'wp_head', 'themify_custom_viewport_tag' );

?>