Adding Extra CSS Class to header.php when scrolling

Adding Extra CSS Class to header.php when scrolling

Since Many days I was trying to make a sticky header for websites and I know what to do for that but didn’t know how to do that.

I was trying to set a transparent header when the website is not scrolling but wanted to add header background color when it is scrolling, so that the header transparent go and make the header readable when it is scrolling. I knew that if I can add an extra class to wordpress header class when it is scrolling then I will be done. So finally I got the way for it. Just add the following code snipet to your wordpress theme function file and then manage it according to your need.

After this just call that CSS class (in this case shrink) to your theme style.css file and you are done.

Hope this helps to everybody.

How can I apply the rules below to IE only?

Apply CSS Rules to IE only

There are 2 ways to do so. One like below

<!--[if IE]>
<style type="text/css">
  IE specific CSS rules go here
</style>
<![endif]-->


And second one like to avoid loading multiple CSS files or to have inline CSS is to hand a class to the body tag depending on the version of Internet Explorer.

<!--[if IE ]><body class="ie"><![endif]-->
<!--[if !IE]>--><body><!--<![endif]-->

Now in your css code, you can simply do:

.ie .abc {
  position:absolute;
  left:30;
  top:-10;
}

How to root your symphone w71i OR any Smartphone

I was searching to root my newly bought symphony w71i set. But couldn’t get a right solution for a long time. But finally I got it. It is so easy to do.

Just download this sofware from this site Here named Kingo root.

After downloading that just install it to your computer and open it.

Then enable USB debugging from your Androind set setting option. Settings >> Developer option >> USB debugging. Tick on that.

After that Just connect your phone to computer using USB cable. Then Kingo softwae will show you Connected phone status. Then just Click Root in the Kingo from your computer. And you are done.

Just don’t do anything untill the process is finish. you can also unroot after you root it.

You can also unroot your phone whenever you need by using this software also.

Here are a new list of best android root software. Checkout this article for this .

Note that Do root at your own risk. As it may damage your phone if it is not done properly.

How to fix ftp “cleartext sessions are not accepted on this serve” error

Cleartext sessions are not accepted on this serve

“421 Sorry, cleartext sessions are not accepted on this server” means that the server is using “FTP Over Explicit TLS/SSL”. This is a Good Thing.

You might be able to fix it by giving the protocol “ftpes:” instead of “ftp:”:

ftpes://ftp.somesite.com/some_folder

… or …

ftps://ftp.somesite.com/some_folder

Disable WordPress Admin Bar

Disable WordPress Admin Bar

Disable Admin Bar for everyone

// Disable Admin Bar for everyone
if (!function_exists('df_disable_admin_bar')) {

	function df_disable_admin_bar() {
		
		// for the admin page
		remove_action('admin_footer', 'wp_admin_bar_render', 1000);
		// for the front-end
		remove_action('wp_footer', 'wp_admin_bar_render', 1000);
	  	
		// css override for the admin page
		function remove_admin_bar_style_backend() { 
			echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
		}	  
		add_filter('admin_head','remove_admin_bar_style_backend');
		
		// css override for the frontend
		function remove_admin_bar_style_frontend() {
			echo '<style type="text/css" media="screen">
			html { margin-top: 0px !important; }
			* html body { margin-top: 0px !important; }
			</style>';
		}
		add_filter('wp_head','remove_admin_bar_style_frontend', 99);
  	}
}
add_action('init','df_disable_admin_bar');

 

Disable Admin Bar for everyone but administrators

// Disable Admin Bar for everyone but administrators
if (!function_exists('df_disable_admin_bar')) {

	function df_disable_admin_bar() {
		
		if (!current_user_can('manage_options')) {
		
			// for the admin page
			remove_action('admin_footer', 'wp_admin_bar_render', 1000);
			// for the front-end
			remove_action('wp_footer', 'wp_admin_bar_render', 1000);
			
			// css override for the admin page
			function remove_admin_bar_style_backend() { 
				echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
			}	  
			add_filter('admin_head','remove_admin_bar_style_backend');
			
			// css override for the frontend
			function remove_admin_bar_style_frontend() {
				echo '<style type="text/css" media="screen">
				html { margin-top: 0px !important; }
				* html body { margin-top: 0px !important; }
				</style>';
			}
			add_filter('wp_head','remove_admin_bar_style_frontend', 99);
			
		}
  	}
}
add_action('init','df_disable_admin_bar');

Disable WP Admin Bar for specific users

// Disable Admin Bar for specific user
if (!function_exists('df_disable_admin_bar')) {

	function df_disable_admin_bar() {
		
		// we're getting current user ID
		$user = get_current_user_id();
		
		// and removeing admin bar for user with ID 123
		if ($user == 123) {
		
			// for the admin page
			remove_action('admin_footer', 'wp_admin_bar_render', 1000);
			// for the front-end
			remove_action('wp_footer', 'wp_admin_bar_render', 1000);
			
			// css override for the admin page
			function remove_admin_bar_style_backend() { 
				echo '<style>body.admin-bar #wpcontent, body.admin-bar #adminmenu { padding-top: 0px !important; }</style>';
			}	  
			add_filter('admin_head','remove_admin_bar_style_backend');
			
			// css override for the frontend
			function remove_admin_bar_style_frontend() {
				echo '<style type="text/css" media="screen">
				html { margin-top: 0px !important; }
				* html body { margin-top: 0px !important; }
				</style>';
			}
			add_filter('wp_head','remove_admin_bar_style_frontend', 99);
			
		}
  	}
}
add_action('init','df_disable_admin_bar');

 

Removing Quick Edit option from wordpress rows

Removing Quick Edit option from wordpress rows

Add this to the theme function File.
function remove_stuff ( $actions ) {
if( !is_super_admin() && !current_user_can( 'edit_theme_options' ) ) {
unset($actions['inline hide-if-no-js']);
return $actions;
} else {
return $actions;
}
}
add_filter ( 'page_row_actions' , 'remove_stuff' );
add_filter ( 'post_row_actions' , 'remove_stuff' );