You can hide admin menu items of wordpress using following code.

 

function remove_menus () {
global $menu;
	$restricted = array(__('Dashboard'), __('Posts'), __('Media'), __('Links'), __('Pages'), __('Appearance'), __('Tools'), __('Users'), __('Settings'), __('Comments'), __('Plugins'));
	end ($menu);
	while (prev($menu)){
		$value = explode(' ',$menu[key($menu)][0]);
		if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);}
	}
}
add_action('admin_menu', 'remove_menus');
Advertisements

Detect Device using php code

Posted: May 24, 2012 in php
Tags: , , ,

Here we can detect the mobile devices using php code. actually the code is detecting the device usign user agent.

please click here to download mobile detect code .

Usage:

1. Download mobile detect code from above link.

2.Include and instantiate the class

include("Mobile_Detect.php");
$detect = new Mobile_Detect();

3.Check for a specific platform:

if($detect->isiOS()){
    // code to run for the Apple iOS platform.
}
if($detect->isAndroidOS()){
    // code to run for the Google Android platform.
}

Other case insensitive available methods are isIphone(), isIpad(), isBlackBerry(), isKindle(), isOpera(), etc. For the full list of available methods check the demo.php file or the wiki.

Alternatively, if you are only interested in checking to see if the user is using a mobile device, without caring for specific platform:

if ($detect->isMobile()) {
    // any mobile platform
}
if($detect->isTablet()){
    // any tablet
}

Transitions using CSS3

Posted: May 24, 2012 in CSS
Tags: , , , ,

Now you can make transitions in your web elements with css3. There is no need of any flash elements , javascript or jQueries. You can just move or slide your element using css3 styling .

div
{
transition: width 2s, height 2s, transform 2s;
-moz-transition: width 2s, height 2s, -moz-transform 2s;
-webkit-transition: width 2s, height 2s, -webkit-transform 2s;
-o-transition: width 2s, height 2s,-o-transform 2s;
}

Gradient using CSS3

Posted: May 24, 2012 in CSS
Tags: , , , ,

Now you can use gradient styling using css3. No need of using images from your design’s or layout some thing. You can create gradient styling using css3.

Check the below example for gradient styling using css3

#linearBg2 { 
/* fallback */
 background-color: #1a82f7; 
background: url(images/linear_bg_2.png);
 background-repeat: repeat-x;
 /* Safari 4-5, Chrome 1-9 */ 
background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(#1a82f7), to(#2F2727));
 /* Safari 5.1, Chrome 10+ */ 
background: -webkit-linear-gradient(top, #2F2727, #1a82f7); 
/* Firefox 3.6+ */
 background: -moz-linear-gradient(top, #2F2727, #1a82f7); 
/* IE 10 */ 
background: -ms-linear-gradient(top, #2F2727, #1a82f7);
 /* Opera 11.10+ */
 background: -o-linear-gradient(top, #2F2727, #1a82f7);
 }

Try it with different styles for your website.

 

Build a responsive WordPress theme from your existing WordPress theme; using CSS3 Media Queries.

A responsive design means a layout that responds well to different screen sizes based on the view-port. Such as iPad, tablets, Smart Phones and Desktop. This tutorial explains how to make responsive theme from your existing wordpress theme css.

What you should already know:
1. How to build a wordpress theme
2. CSS knowledge

To make the theme responsive using CSS media query you have to use the css link tag media attribute value as “screen”.

Please check below example

<link rel="stylesheet" href="{Your css URl}" type="text/css" media="screen" />


and also use the view-port meta tag

<meta name="viewport" content="width=device-width">
 


And then use the media queries in your css

 
/* iPad Portrait */

@media only screen and (max-width: 768px) {
 Your Style here
}

/* iPad Landscape */

@media only screen and (max-width: 1024px) {
Your Style here
}
@media only screen and (max-width: 940px) {
Your Style here
}

/*layouts smaller than 600px, iPhone and mobiles*/
@media only screen and (max-width: 480px), screen and (max-device-width: 480px), screen and (max-width: 600px)  {
Your Style here
}

/* iPhone Landscape */
@media screen and (max-width: 480px) and (orientation: landscape) {
Your Style here
}

/* iPhone Portrait */
@media screen and (max-width: 480px) and (orientation: portrait) {
Your Style here
}