Wednesday, March 30, 2011

How to remove WordPress admin bar from front end

In the following process you can  remove WordPress 3.1 admin bar

WordPress 3.1 introduced a new feature: the admin bar. It is very useful, but if you like to remove it. Please follow the instruction.

Paste the following piece of code into your functions.php file, save it to remove admin bar.

wp_deregister_script('admin-bar');
wp_deregister_style('admin-bar');
remove_action('wp_footer','wp_admin_bar_render',1000);

Thursday, March 24, 2011

How to replace words in your wordpress posts

Replace words in your wordpress posts

Let your Wordpress blog was named “portfolio” and you renamed it “myportfolio”. Then don’t edit your xxx posts to replace every single occurence! With this very useful code will do it for you, like a magic!


Just put words to replace in the array on line 4. Once done, paste the code into your function.php file, save the file, and you're ready!

function replace_text_wps($text){
   $replace = array(
       // 'WORD TO REPLACE' => 'REPLACE WORD WITH THIS'
       'portfolio' => 'myportfolio',
       'excerpt' => 'excerpt',
       'function' => 'function'
   );
   $text = str_replace(array_keys($
replace), $replace, $text);
   return $text;
}

add_filter('the_content', 'replace_text_wps');
add_filter('the_excerpt', 'replace_text_wps');

I just got my #domain @BigRock. Get upto 25% off with my personalized coupon link Get upto 25% off