首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何创建Wordpress公告栏

如何创建Wordpress公告栏
EN

Stack Overflow用户
提问于 2014-08-10 07:49:28
回答 1查看 2.8K关注 0票数 1

我想为我的wordpress website.It创建一个公告栏,我们可以在那里写更新,策划促销活动等。我尝试了许多插件,如WP公告板,bbpress等,但它们太复杂了。有什么简单的插件可以用来创建公告板吗?

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2014-08-10 11:22:16

为什么不创建一个新的自定义帖子类型,并使用它作为公告板?

代码语言:javascript
复制
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文件中,您将有一个全新的事件部分,其行为与文章完全相同。

如果你给我一些更多的信息,我可以为你定制更多的代码。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/25226620

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档