add_theme_support('post-thumbnails');
set_post_thumbnail_size(120, 100, true);
-function wpse_setup_theme() {
- add_image_size('glm_block1', 590, 590,true);
- add_image_size('glm_block2_3', 285, 285, false);
- add_image_size('glm_block4', 590, 285, true);
- add_image_size('landing_page', 386, 285, true);
-}
+add_image_size('glm_block1', 590, 590,true);
+add_image_size('glm_block2_3', 285, 285, false);
+add_image_size('glm_block4', 590, 285, true);
+add_image_size('landing_page', 386, 285, true);
-add_action( 'after_setup_theme', 'wpse_setup_theme' );
}
add_action('thematic_searchloop', 'mytheme_search_loop');
// End of the Contextual/Highlight Search functions
+
+// add shortcode for the landing page blocks
+function landing_page_blocks( $atts )
+{
+ extract(shortcode_atts(
+ array('category' => '-1'), $atts, 'glm-blocks')
+ );
+ if(function_exists('fetch_all_glm_blocks')):
+ $category = filter_var($atts['category'], FILTER_VALIDATE_INT);
+ $blocks = fetch_all_glm_blocks($category);
+ echo '<ul id="quick-sub_pages" class="small-block-grid-1 medium-block-grid-3">';
+ foreach ($blocks as $block):
+ $post_image_id = get_post_thumbnail_id($block->ID);
+ $thumbnail = wp_get_attachment_image_src( $post_image_id, 'landing_page');
+ echo '<li class="small-text-center medium-text-left landing-item">';
+ if($block->url):
+ echo '<a href="'.$block->url.'"'.(($block->externalUrl)? ' target="_blank"':'').'>';
+ endif;
+ echo '<img src="'.$thumbnail[0].'"/>';
+ echo '<h5>'.$block->post_title.'</h5>';
+ if($block->url):
+ echo '</a>';
+ endif;
+ echo '</li>';
+ endforeach;
+ echo '</ul>';
+ endif;
+}
+add_shortcode('glm-blocks', 'landing_page_blocks');
?>
<?php endif;?>
</div>
</div>
- <div class="row">
- <ul id="quick-sub_pages" class="small-block-grid-1 medium-block-grid-3">
- <?php if(function_exists('fetch_all_glm_blocks')):?>
- <?php $blocks = fetch_all_glm_blocks(7591);?>
- <?php foreach ($blocks as $block):?>
- <?php $post_image_id = get_post_thumbnail_id($block->ID); ?>
- <?php $thumbnail = wp_get_attachment_image_src( $post_image_id, 'landing_page'); ?>
- <li class="small-text-center medium-text-left landing-item">
- <?php if($block->url):?>
- <a href="<?php echo $block->url;?>"<?php if($block->externalUrl){echo ' target="_blank"';}?>>
- <?php endif;?>
- <img src="<?php echo $thumbnail[0]; ?>"/>
- <h5><?php echo $block->post_title;?></h5>
- <?php if($block->url):?>
- </a>
- <?php endif;?>
- </li>
- <?php endforeach;?>
- <?php endif;?>
-<!--
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Arts-and-Entertainment.jpg"><h5>Arts & Entertainment</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Bicycling.jpg"><h5>Bicycling</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Casinos-and-Nightlife.jpg"><h5>Casinos & Nightlife</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Museums-and-Attractions.jpg"><h5>Museum & Attractions</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Sports-and-Golf.jpg"><h5>Sports & Golf</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Shopping.jpg"><h5>Shopping</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Farm-Markets-and-Orchards.jpg"><h5>Farm Markets & Orchads</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Recreation-and-Parks.jpg"><h5>Recreation & Parks</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/Tours.jpg"><h5>Tours</h5></a></li>
- <li class="small-text-center medium-text-left landing-item"><a><img src="<?php bloginfo('template_url');?>/assets/landing-img/269-Cool-Things-To-Do.jpg"><h5>269™ Cool Things To Do</h5></a></li>
--->
- </ul>
- </div>
<div class="row">
<?php the_block( 'member_block', array(
'label' => __('Member Short Code', 'text-domain'),