foreach ($blocks as $block) {
$block->externalUrl = false;
$custom = get_post_custom($block->ID);
- switch ($custom['glm_block_url'][0]) {
- case 'event':
- $block->url = get_permalink($custom['glm_block_event'][0]);
- break;
- case 'page':
- $block->url = get_permalink($custom['glm_block_page'][0]);
- break;
- case 'post':
- $block->url = get_permalink($custom['glm_block_post'][0]);
- break;
- case 'url':
- if ($custom['glm_block_ext_url'][0] != '') {
- $block->url = (preg_match('/^http:\/\//', $custom['glm_block_ext_url'][0]))
- ? $custom['glm_block_ext_url'][0]
- : 'http://' . $custom['glm_block_ext_url'][0];
- $block->externalUrl = true;
+ if (isset($custom['glm_block_url'])) {
+ switch ($custom['glm_block_url'][0]) {
+ case 'event':
+ $block->url = get_permalink($custom['glm_block_event'][0]);
+ break;
+ case 'page':
+ $block->url = get_permalink($custom['glm_block_page'][0]);
+ break;
+ case 'post':
+ $block->url = get_permalink($custom['glm_block_post'][0]);
+ break;
+ case 'url':
+ if ($custom['glm_block_ext_url'][0] != '') {
+ $block->url = (preg_match('/^http:\/\//', $custom['glm_block_ext_url'][0]))
+ ? $custom['glm_block_ext_url'][0]
+ : 'http://' . $custom['glm_block_ext_url'][0];
+ $block->externalUrl = true;
+ }
+ break;
}
- break;
}
$block->thumbnail = get_the_post_thumbnail(
$block->ID, GLM_BLOCK_POST_TYPE, array('class' => 'aligncenter')