自定义帖子类型未显示在管理菜单中

时间:2020-10-26 14:11:53

标签: wordpress plugins custom-post-type

我制作了两个自定义帖子类型插件。 它们只有在一次只有一个被激活时才能正常工作。 两者都激活后,它们之一将停止工作,并且不再显示在管理菜单中。

我尝试过: 停用所有其他插件。 通过“ menu_position”更改排名顺序。

输入'show_in_admin_bar'=>是,'show_in_nav_menus'=>是,'show_in_menu'=>是

但没有成功...

这是我的两种自定义帖子类型的代码:

<template>
  <div :style="{backgroundImage:'url('+imageName+')'}">
  </div>
</template>

<script>
export default {
  name:"niceName",
  data:()=> ({
    imageName:"",
  }),
  mounted() {
    this.imageName=require('@/assets/images/backgrounds/'+anyVariable.anyImgName);
  }
}
</script>

<style>
</style>

第二个:

class LLBAnnouncement
{
    public function register()
    {
        add_action('init', [$this, 'customPostTypeAnnouncement']);
    }

    public function customPostTypeAnnouncement()
    {
        $args = [
            'label' => 'LLB Announcements',
            'supports' => [
                'title',
                'editor',
                'thumbnail'
            ],
            'public' => true,
        ];
        register_post_type('announcements', $args);
    }
}

感谢您的帮助!

0 个答案:

没有答案