<?php
if(strpos($_SERVER[‘HTTP_USER_AGENT’], ‘MSIE’) !== FALSE)
echo ‘Internet explorer’;
elseif(strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Firefox’) !== FALSE)
echo ‘Mozilla Firefox’;
elseif(strpos($_SERVER[‘HTTP_USER_AGENT’], ‘Chrome’) !== FALSE)
echo ‘Google Chrome’;
else
echo ‘Something else’;
?>
Monthly Archives: December 2012
jquery Browser Detecting
if($.browser.mozilla == true) {
//do something
alert(‘mozilla’);
} else if($.browser.safari == true){
//do something else
alert(‘safari’);
}else if($.browser.opera == true){
//do something else
alert(‘opera’);
} else if($.browser.msie == true){
//do something else
alert(‘msie’);
} else if($.browser.webkit == true){
//do something else
alert(‘webkit’);
}
Call a file in Plugin
<script src=”<?php echo plugin_dir_url(”); ?>plugin-name/file.js”></script>
Display Slug Name
<?php if ( have_posts() ) while ( have_posts() ) : the_post(); ?>
<?php global $post; echo $post->post_name; ?>
<?php endwhile; ?>
Display parent page id using child page
<?php
if ($post->post_parent) {
$ancestors=get_post_ancestors($post->ID);
$root=count($ancestors)-1;
$parent = $ancestors[$root];
} else {
$parent = $post->ID;
} ?>
Display Result as Graph of Quiz
Home–>Courses–>Your quiz–>Results–>Grades
Display Home Page content
Site administration–>Front Page–>Front Page Settings (checked the option: Include a topic section numsections)
Add Roles
Site administration–>Front Page–>Front Page Roles