我正在创建事件生成器插件。我已经创建了在主页上显示所有事件名称的快捷码。现在单击事件名称,我想显示该事件的描述。如何在插件中做到这一点?下面是我的代码:
function event_display(){?>
<?php global $wpdb;
$myrows = $wpdb->get_results( "SELECT event_cat_id, event_cat_name FROM tcm_event_category" );
foreach($myrows as $myrow){
echo "<h3>".$myrow->event_cat_name."</h3>";
$evetcatid = $myrow->event_cat_id;
$myevents = $wpdb->get_results( "SELECT event_id, event_name, event_desc, event_short_desc, event_startDate, event_bookFee FROM tcm_event WHERE event_catt_id=$evetcatid" );
foreach($myevents as $myevent){
echo "<div class=\'event\' style=\'\'>";
echo "<p style=\'width:100%;\'><a href=\'?detail_event_display($myevent->event_id)\'>".$myevent->event_name."</a></p>";
echo "<p style=\'width:70%;float:left;\'>".$myevent->event_short_desc."</p>";
echo "<p style=\'width:30%;float:right;\'>".$myevent->event_startDate."</p>";
echo "<p style=\'width:30%;float:right;\'> Rs. ".$myevent->event_bookFee."</p>";
echo "</div>";
}
}
}
function detail_event_display($eventid){
echo $eventid;
}
add_shortcode(\'events\', \'event_display\');