我使用Members插件来管理我网站上的权限。对于标准模板,它非常有效-当用户没有查看页面的权限时,他们会收到以下消息:
抱歉,您没有查看此内容的权限。
如何确保在自定义模板中仍能收到此消息?我需要包括哪个标签?
EDIT. 模板来源:
<?php
/*
Template Name: Stats
*/
?>
<?php
get_header();
?>
<div id="main">
<div id="contentwrapper">
<div class="topPost">
<h2 class="topTitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
<div class="topContent">
<p>Listeners are counted every minute. The green line is the <b>maximum</b> during any given time period. The red area is the <b>average</b> number of listeners during the same time period.</p>
<h3>Listeners over the last hour</h3>
<img class="alignnone" title="Listeners over the last hour" src="<?php echo get_graph(60,60); ?>" alt="" width="481" height="149" />
<hr/>
<h3>Listeners over the last day</h3>
<img class="alignnone" title="Listeners over the last day" src="<?php echo get_graph(3600,24); ?>" alt="" width="481" height="149" />
<hr/>
<h3>Listeners over the last week</h3>
<img class="alignnone" title="Listeners over the last week" src="<?php echo get_graph(86400,7); ?>" alt="" width="481" height="149" />
</div>
<div class="cleared"></div>
<div class="cleared"></div>
</div> <!-- Closes topPost -->
</div> <!-- Closes contentwrapper-->
<?php get_sidebar(); ?>
<div class="cleared"></div>
</div><!-- Closes Main -->
<?php get_footer(); ?>
注意:此模板的目的是充当shell脚本的前端。数据库中的任何内容都是无关的,因此没有循环。(虽然包括一个虚拟循环似乎没有帮助。)