Right now, many blogger uses WordPress for their Publishing platform, I will give some tips how to save space on your WordPress blog server. We will added little bit php code in our functions.php theme files. This code is Automatically uses resized images instead the originals size.
Write code to Automatically uses resized images insteaad the originals below
function replace_uploaded_image($image_data) {
// if there is no large image : return
if (!isset($image_data['sizes']['large'])) return $image_data;
// paths to the uploaded image and the large image
$upload_dir = wp_upload_dir();
$uploaded_image_location = $upload_dir['basedir'] . '/' .$image_data['file'];
$large_image_location = $upload_dir['path'] . '/'.$image_data['sizes']['large']['file'];
// delete the uploaded image
unlink($uploaded_image_location);
// rename the large image
rename($large_image_location,$uploaded_image_location);
// update image metadata and return them
$image_data['width'] = $image_data['sizes']['large']['width'];
$image_data['height'] = $image_data['sizes']['large']['height'];
unset($image_data['sizes']['large']);
return $image_data;
}
add_filter('wp_generate_attachment_metadata','replace_uploaded_image');
This code is doing automatically, so you didn’t needed any command anymore. Thanks for Serge Rauber for tricks about Save Space in WordPress blog server.




Remove nofollow attributes from comment text
February 19th, 2010 By WP Tricks Posted in TipsWordPress added nofollow attributes on comment text url, this is bad for some commeter that needed some backlinks, if you want remove nofollow attributes from comment text in your WordPress site is easely, all need to do just added some code on functions.php on your theme and added some wordpress hooks using add_filter functions and your external url on comment text will be gone.
Write down to remove noffolow attributes on comment text below
function remove_nofollow($string) { $string = str_ireplace(' rel="nofollow"', '', $string); return $string; } add_filter('comment_text', 'remove_nofollow');And done, now you can check on your comment area with url and the nofollow attributes is gone
thanks for DigWP for share this code
Amazing Touch
Tags: add_filter, Comment, dofollow, Hooks, nofollow
18 Comments