我想为我的wordpress website.It创建一个公告栏,我们可以在那里写更新,策划促销活动等。我尝试了许多插件,如WP公告板,bbpress等,但它们太复杂了。有什么简单的插件可以用来创建公告板吗?
发布于 2014-08-10 11:22:16
为什么不创建一个新的自定义帖子类型,并使用它作为公告板?
function bb_custom_post_event() {
$labels = array(
'name' => _x( 'Events', 'post type general name' ),
'singular_name' => _x( 'Event', 'post type singular name' ),
'add_new' => _x( 'Add New', 'event' ),
'add_new_item' => __( 'Add New Event' ),
'edit_item' => __( 'Edit Event' ),
'new_item' => __( 'New Event' ),
'all_items' => __( 'All Events' ),
'view_item' => __( 'View Events' ),
'search_items' => __( 'Search Events' ),
'not_found' => __( 'No events found' ),
'not_found_in_trash' => __( 'No events found in the Trash' ),
'parent_item_colon' => '',
'menu_name' => 'Bulletin Board'
);
$args = array(
'labels' => $labels,
'description' => '',
'public' => true,
'menu_position' => 25,
'menu_icon' => 'dashicons-calendar',
'supports' => array( 'title', 'editor', 'thumbnail', 'excerpt', 'comments' ),
'has_archive' => true,
);
register_post_type( 'event', $args );
}
add_action( 'init', 'bb_custom_post_event' );将上面的代码粘贴到您的functions.php文件中,您将有一个全新的事件部分,其行为与文章完全相同。
如果你给我一些更多的信息,我可以为你定制更多的代码。
https://stackoverflow.com/questions/25226620
复制相似问题