Shortcode not working in widget

BY default short-codes are not working in widget area for this you have to add one line code in your functions.php file

add_filter('widget_text', 'do_shortcode');
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
 

Custom log out to home page in wordpress

add this code in theme function file (function.php)

function My_Log_Out() {

    $home =home_url();

    wp_redirect( $home );

    exit;
}

add_action('wp_logout', 'My_Log_Out');
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
 

Custom file Upload in (spicifiec directory) WordPress

<?php
$dir = wp_upload_dir();

$target_dir = $dir['basedir'] .'/';

$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

if(move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file))
{
    $url = $dir['baseurl'].basename($_FILES["fileToUpload"]["name"]);

//  update if want to update image 

    update_user_meta( $user_id, 'upload_field', $url);
}
?>

<form  action="" method="post" enctype="multipart/form-data">

<input type="file" name="fileToUpload" id="fileToUpload">

<input type="submit" name="uploade" value="Uplaode Image" />

</form>
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone
 

How to crop image in wordpress?

Please try below code.

<?php 
$img = 'full image path'; //img URL 
$crop_image = aq_resize( $img, 352, 264, true ); // get crop image 
?> 
<img src="<?php echo $crop_image ?>" > 
Share on Google+Share on FacebookTweet about this on TwitterEmail this to someone