カスタムフィールドのファイル
$cf = get_post_meta($post->ID);
$file_info = get_file_info_by_attachment_id($cf['cf_pdf'][0]);
/**
* カスタムフィールドのファイル項目のIDからファイルの情報を返す
* @param $attachment_id
* @return string
*/
function get_file_info_by_attachment_id($attachment_id){
$file_url = wp_get_attachment_url($attachment_id);
$upload_dir = wp_upload_dir();
$file_path = realpath($upload_dir['path'] . DIRECTORY_SEPARATOR . basename($file_url));
$result = array(
'url' => $file_url,
'path' => $file_path,
'realsize' => filesize($file_path),
);
return $result;
}