public function metaBoxCallBack($post)
{
- $glm_blocks_url = ($post)
+ $glm_block_url = ($post)
? get_post_meta($post->ID, 'glm_block_url', true)
: '';
- $glm_blocks_ext_url = ($post)
+ $glm_block_ext_url = ($post)
? get_post_meta($post->ID, 'glm_block_ext_url', true)
: '';
- $glm_blocks_page = ($post)
+ $glm_block_page = ($post)
? get_post_meta($post->ID, 'glm_block_page', true)
: '';
include $this->pluginDirName . 'views/admin/metaBoxes.php';
);
$blocks = get_posts($args);
foreach ($blocks as $block) {
+ $block->externalUrl = false;
$custom = get_post_custom($block->ID);
if ($custom['glm_block_url'][0] == 'page') {
$block->url = get_permalink($custom['glm_block_page'][0]);
}
if ($custom['glm_block_url'][0] == 'url') {
- $block->url = $custom['glm_block_ext_url'][0];
+ 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;
+ }
}
$block->thumbnail = get_the_post_thumbnail(
$block->ID, array(298, 228), array('class' => 'aligncenter')