Get custom attribute value in Magento

$attribute=$_product->getResource()->getAttribute('custom_attribute_code');
if ($attribute)
{
    echo $attribute_value = $attribute ->getFrontend()->getValue($_product);
}

Hope it will you.