基于PHP模板文件中占位符范围和用法的单个事件页面

时间:2020-09-08 作者:vanurag

我们正在使用此插件:https://wordpress.org/plugins/events-manager/

我们希望在单个事件页面上显示类似的内容。

I am struggling with how to output PLACEHOLDER in my PHP File:

if(event_scope == PAST){
//Display with this HTML
}
else{
//Normal Display
}
为了实现这一点,我将单个事件文件复制到/wp-content/themes/my-child-theme/plugins/events-manager/templates/event-single。php

这是我添加的代码。这很有效,但我不知道在占位符中使用什么

if($EM_Event->event_end_date < date(\'Y-m-d\')){
    echo \'PAST\';
    <div class="single-event-detail-header">Event Details</div>
<div class="single-event-desc">
<div class="event-image">#_EVENTIMAGE</div>
<ul class="event-details-list">
  <li><span class="date-icon">#l | #_EVENTDATES</span></li>
  <li><span class="time-icon">#_EVENTTIMES </span></li>
{has_location}
<li>
    <span class="location-icon"> #_LOCATIONNAME 
        #_LOCATIONADDRESS #_LOCATIONTOWN #_LOCATIONSTATE #_LOCATIONPOSTCODE
    </span></li>
{/has_location}
[listMembertypes]
{no_location}
<li><img class="video-confress" src="/wp-content/uploads/2020/08/video.png" alt="" style="width: 18px;"><span class="zoom-webinar" style="left: 13px;">Zoom Webinar</span></li>
{/no_location}
</ul>
</div>
<ul class="event-buttons">
        <li class="register"><a href="#_ATT{registration_link}" target="_blank">Register</a></li>
                
</ul>
#_EVENTNOTES
{has_bookings}
<h3>Bookings</h3>
#_BOOKINGFORM
{/has_bookings}

<div class="next-location">
<p><strong>Upcoming Events:</strong>
#_LOCATIONNEXTEVENTS
</div>
</br>
<div class="float-map-right">{has_LOCATIONMAP}#_LOCATIONMAP<br />{/has_LOCATIONMAP}
    {has_locationnextevents}
    <h3>Events at This Location</h3>
    {/has_locationnextevents}
</div>
    
    ?>

<?php
}else{
    echo \'Future\';
    
}

1 个回复
SO网友:Michelle

您需要移动模板文件,而不是

/wp-content/themes/my-child-theme/plugins/events-manager/templates/event-single.php
你应该把它们放在这里:

/wp-content/themes/my-child-theme/events-manager/event-single.php
请参阅此文档页:https://wp-events-plugin.com/documentation/using-template-files/