Browse Happy

Not sure if this is required any more but this is how we used to add a message to a site for browsers using old versions of IE.

Functions:

<?php
require get_template_directory() . '/components/browse-happy/template-tags-browser.php';

Add this to the header.php

<body <?php body_class(); ?> >
// add this line below...
	<?php gomo_browse_happy() ?>

Template tag code:

<?php
function gomo_browse_happy() {
	?>
	<!--[if lte IE 8]>
	<div class="browsehappy-container"><p class="browsehappy">You are using an <strong>outdated</strong> browser.<br />Please <a href="https://browsehappy.com/">upgrade your browser</a> to view this site.</p></div>
	<![endif]-->
	<?php
	gomo_browser_styles ();
}
function gomo_browser_styles () {
	?>
	<style>
		.browsehappy-container {
			position: fixed;
			left: 0px;
			top: 0px;
			right: 0px;
			bottom: 0px;
			width: 100%;
			height: 100%;
			z-index: 99999;
			background:black;
			margin: 0px;
			padding: 0px;
			text-align: center;
			font-size: 60px;
			line-height: 90px;	
			color: white;
		}
		.browsehappy {
			margin: 10% auto;
			width:80%;
			max-width: 800px;
			text-align: center;
			font-size: 30px;
			line-height: 40px;	
			color: white;
		}
		.browsehappy a {
			color: white;
		}
		
	</style>
	<?php
}
add_action( 'wp_head', 'gomo_browser_styles', 1 );
?>

Search the site


Address

123 Main Street
Town
City
P05T C0D3

Tel: 01234 567 899

Mob: 01234 567 899

Email: ben@gomopress.com


Copyright 2023. Blah blah blah Company Limited