我试图编写自己的插件,但每次出现错误或元框不能正确显示。metabox在wordpress插件中无法正确显示
这是我的插件代码 请参阅它在代码头上显示的代码。我想在“编辑器”框下面显示它 我累了,但无法正确显示。
<?php
/*
Plugin Name: party event
Plugin URI: http://careertracker.net
Version: 1.0
Author: Savan Paun
Description: event sample plugin
*/
// Registers the new post type and taxonomy
function wpt_event_posttype() {
register_post_type('events',
array(
'labels' => array(
'name' => __('Events'),
'singular_name' => __('Event'),
'add_new' => __('Add New Event'),
'add_new_item' => __('Add New Event'),
'edit_item' => __('Edit Event'),
'new_item' => __('Add New Event'),
'view_item' => __('View Event'),
'search_items' => __('Search Event'),
'not_found' => __('No events found'),
'not_found_in_trash' => __('No events found in trash')
),
'public' => true,
'supports' => array('title', 'editor', 'thumbnail', 'comments'),
'capability_type' => 'post',
'rewrite' => array("slug" => "events"), // Permalinks format
'menu_position' => 5,
'register_meta_box_cb' => 'add_events_metaboxes'
)
);
}
add_action('init', 'wpt_event_posttype');
function add_events_metaboxes()
{
?>
<table width=450 border=1>
<tr>
<td width=139>Foods</td>
<td width=295>
<label for=select></label>
<select name=food id=food>
<option value="Pizza">Pizza</option>
<option value="Hotdog">Hotdog</option>
</select>
</td>
</tr>
<tr>
<td>Tea</td>
<td><select name=tez id=tea>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select></td>
</tr>
<tr>
<td>Person</td>
<td><label for=textfield></label>
<input type=text name=textfield id=textfield /></td>
</tr>
</table>
<?php
}
?>
你试过add_meta_box()动作???? http://codex.wordpress.org/Function_Reference/add_meta_box – Yatendra
在插件我试图让自己的插件检查您的本地服务器中的代码一次.. – vivek