我认为,您的方法应该有效,我只会检查短PHP打开标记<?
正在服务器配置中工作,因为它们已被弃用一段时间,应替换为<?PHP
.
或者,您是否尝试过plugin\'s docs 使用内置功能tribe_get_events()
:
<ul class="evul" >
<?PHP
// Ensure the global $post variable is in scope
global $post;
$events = tribe_get_events();
// Loop through the events: set up each one as
// the current post then use template tags to
// display the title and content
foreach ( $events as $post ) {
setup_postdata( $post );
// This time, let\'s throw in an event-specific
// template tag to show the date after the title!
?>
<li class="evlist" id="evli-">
<span class="evdate" id="evspd-">
<?= tribe_get_venue($post) ?>
</span>
<span class="evtype" id="evspt-">
<?= tribe_get_events_link($post) ?>:
</span>
<span class="evdesc" id="evspds-">
<?= get_the_title($post); ?>
</span>
</li>
<?PHP
}
?>
</ul>