我有以下数组em_events(array(
,需要插入以下foreach来重复$delete
链接。如何将foreach放入数组中?不确定如何最好地描述这一点。
foreach ($EM_Events as $event) {
$delete = esc_url(add_query_arg(array('action'=>'event_delete', 'event_id'=>$event->event_id, '_wpnonce'=> wp_create_nonce('event_delete_'.$event->event_id))));
}
em_events(array(
'owner'=>4,
'limit'=>10,
'scope'=>'all',
'format'=>'
<li class="even portfolio-entry">
<div class="entry-thumb standard">
<a class="thumblink" href="'.$delete.'"><span class="thumbnail">#_EVENTIMAGE{220,220}</span><span class="extra"><strong>Edit Event</strong></span></a>
</div>
<div class="entry-title">
<a href="#_EVENTURL" title="#_EVENTURL" rel="bookmark"><span style="color:#00b1d9;">PREVIEW EVENT POST</span><span>#F #j, #Y</span>#_NAME</a>
</div>
</li>
'
));
答案 0 :(得分:1)
我认为你想要的是:
foreach ($EM_Events as $event) {
$delete = esc_url(add_query_arg(array('action'=>'event_delete', 'event_id'=>$event->event_id, '_wpnonce'=> wp_create_nonce('event_delete_'.$event->event_id))));
em_events(array(
'owner'=>4,
'limit'=>10,
'scope'=>'all',
'format'=>'
<li class="even portfolio-entry">
<div class="entry-thumb standard">
<a class="thumblink" href="'.$delete.'"><span class="thumbnail">#_EVENTIMAGE{220,220}</span><span class="extra"><strong>Edit Event</strong></span></a>
</div>
<div class="entry-title">
<a href="#_EVENTURL" title="#_EVENTURL" rel="bookmark"><span style="color:#00b1d9;">PREVIEW EVENT POST</span><span>#F #j, #Y</span>#_NAME</a>
</div>
</li>'
));
}
答案 1 :(得分:0)
这个怎么样:
$format=NULL;
foreach ($EM_Events as $event) {
$delete = esc_url(add_query_arg(array('action'=>'event_delete', 'event_id'=>$event->event_id, '_wpnonce'=> wp_create_nonce('event_delete_'.$event->event_id))));
$format=$format.
'<li class="even portfolio-entry">
<div class="entry-thumb standard">
<a class="thumblink" href="'.$delete.'"><span class="thumbnail">#_EVENTIMAGE{220,220}</span><span class="extra"><strong>Edit Event</strong></span></a>
</div>
<div class="entry-title">
<a href="#_EVENTURL" title="#_EVENTURL" rel="bookmark"><span style="color:#00b1d9;">PREVIEW EVENT POST</span><span>#F #j, #Y</span>#_NAME</a>
</div>
</li>';
}
em_events(array(
'owner'=>4,
'limit'=>10,
'scope'=>'all',
'format'=>$format,
));
答案 2 :(得分:0)
我最终走向完全不同的方向。遗憾