下面是一个基本的页面模板,用于根据插件附带的网格模板以网格形式显示事件日历。根据需要进行编辑,以匹配主题的样式和布局:
<?php
/**
* Template Name: Event Gridview
**/
global $spEvents;
$spEvents->loadDomainStylesScripts();
get_header();
query_posts(\'post_type=post&category_name=Events&posts_per_page=-1\');
?>
<div id="tec-content" class="grid">
<div id=\'tec-events-calendar-header\' class="clearfix">
<h2 class="tec-cal-title"><?php _e(\'Calendar of Events\', $spEvents->pluginDomain) ?></h2>
<span class=\'tec-month-nav\'>
<span class=\'tec-prev-month\'>
<a href=\'<?php echo events_get_previous_month_link(); ?>\'>
← <?php echo events_get_previous_month_text(); ?>
</a>
</span>
<?php get_jump_to_date_calendar( "tec-" ); ?>
<span class=\'tec-next-month\'>
<a href=\'<?php echo events_get_next_month_link(); ?>\'>
<?php echo events_get_next_month_text(); ?> →
</a>
</span>
</span>
<span class=\'tec-calendar-buttons\'>
<a class=\'tec-button-off\' href=\'<?php echo events_get_listview_link(); ?>\'><?php _e(\'Event List\', $spEvents->pluginDomain)?></a>
<a class=\'tec-button-on\' href=\'<?php echo events_get_gridview_link(); ?>\'><?php _e(\'Calendar\', $spEvents->pluginDomain)?></a>
</span>
</div><!-- tec-events-calendar-header -->
<?php
global $wp_query;
$tecCatObject = get_category( $wp_query->query_vars[\'cat\'])
?>
<a class="ical" href="<?php bloginfo(\'home\'); ?>/?ical=<?php echo $tecCatObject->slug; ?>"><?php _e(\'iCal Import\', $spEvents->pluginDomain) ?></a>
<?php event_grid_view(); // See the plugins/the-events-calendar/views/table.php template for customization ?>
</div>
<?php /* For custom template builders...
* The following init method should be called before any other loop happens.
*/
wp_reset_query();
$wp_query->init(); ?>
<?php get_footer(); ?>
关键组件是
query_posts
在调用标头后调用。您可以使用此选项修改插件视图子文件夹中的其他模板文件,以将其他日历视图调整为其他页面模板。
我已经使用Wordpress v3中链接的插件的免费版本对此进行了测试。2.1,无需短代码。