Browser detection with wordpress function

<?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; } ?>

Add class to specific post

Add class to specific post if its not home Ever wonder if you want to add a specific class for specific post in the body element. Below code will help you to add a class if its not a home page. add_filter( ‘body_class’, ‘my_neat_body_class’); function my_neat_body_class( $classes ) { if (! is_home()) $classes[] = ‘not-home’; […]

if condition to detect localhost and server

if condition to detect localhost and server Copy the below php code of if condition to detect localhost and server.  <?php if($_SERVER[‘HTTP_HOST’] ==’localhost:8080′) { define(‘DB_NAME’, ‘localdatabasename’); define(‘DB_USER’, ‘root’);//mostly root define(‘DB_PASSWORD’, ”); } else { define(‘DB_NAME’, ‘server database name’); define(‘DB_USER’, ‘server database user’); define(‘DB_PASSWORD’, ‘dbpassword’); } ?>