Hi,

Many wordpress theme is not supported perfectly in many web browsers. In order to detect the visitors’ web browser, you can use this hack. For that you need to add this code in functions.php file of your theme:

<?php
add_filter(‘body_class’,'browser_body_class’);
function browser_body_class($classes) {
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;

if($is_lynx) $classes[] = ‘lynx’;
elseif($is_gecko) $classes[] = ‘gecko’;
elseif($is_opera) $classes[] = ‘opera’;
elseif($is_NS4) $classes[] = ‘ns4′;
elseif($is_safari) $classes[] = ’safari’;
elseif($is_chrome) $classes[] = ‘chrome’;
elseif($is_IE) $classes[] = ‘ie’;
else $classes[] = ‘unknown’;

if($is_iphone) $classes[] = ‘iphone’;
return $classes;
}
?>
Once you update the functions.php the function will automatically add a CSS class to the body tag. Here is one example:

<body>

Now, you need to define the stylesheet according to the browser in style.css

That’s it!

Thanks,

Shane G.

Popularity: 1%

Related posts:
  1. Case Study: No QuickTag Buttons In Safari Web Browser – Wordpress Hi, Problem Description: The Quicktag buttons in the wordpress admin...
  2. Case Study: The bullets and Number not working for a particular browser   Case Study: The bullets and Number not working for a...
  3. Automated Browser Activation Automated Browser Activation An alternative to manual browser activation is...
  4. Requirement details for Google Reader Widget in WordPress Blog Hello All, In order to add Google Reader Widget in...
  5. How To Remove Author Details from posts In Wordpress Blog? Hi, To remove author details from wordpress posts…need to remove...

Leave a Reply

You must be logged in to post a comment.