• Resolved ValterTF

    (@valtertf)


    Hello, Elegant Themes support suggested your plugin, as an easy and reliable way to creating Custom Post Types. Great work. I’m sure it’s not a bug, but an error on my part: I’m unable to show the the CPT created using your plugin in the Admin bar. I made a search here, and checked previous support posts. No luck. The CPT does show in the “NEW” Menu. I need it to be shown in the admin area, but should not be shown neither searchable in the website itself. Here are my settings:

    public: true
    publicly_queryable: false
    show_ui: true
    show_in_nav_menus: false
    delete_with_user: false
    show_in_rest: false
    rest_base: ""
    rest_controller_class: ""
    has_archive: true
    has_archive_string: ""
    exclude_from_search: true
    capability_type: post
    hierarchical: true
    rewrite: true
    rewrite_slug: ""
    rewrite_withfront: true
    query_var: true
    query_var_slug: ""
    menu_position: 68
    show_in_menu: true
    show_in_menu_string: Cadastro
    menu_icon: dashicons-admin-page
    custom_supports: ""

    What am I missing? Thanks in advance.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    In what way are you trying to show post type info in the admin bar? The “New” menu item makes sense, but are you trying to show some sort of info in a different way?

    Thread Starter ValterTF

    (@valtertf)

    I’m trying to add a new item to the admin bar for the new CPT. Today there are Posts, Media, Pages, Comments, Projects and so on, each with its own submenus. As an example: a new CPT called “Customers’ (with its submenu items like All Customers, New Customer, Categories and Tags) – pretty much a clone of the “Post” in the admin bar.
    If I understood your instructions, it should be almost automatically done if both “public” and “show_in_menu” are set as true. I know I’m missing something.

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Ahh, I was confused by “admin bar” because that’s the black bar that shows along the top of the admin area. You’re thinking the admin menu on the left.

    Looking at the settings provided, I’d first remove this menu_position: 68 and just let it fall back to default and see if it shows up then. The menu position value may be clashing with something else. If that causes it to show up, then we know the source, and can then start trying different position values until everything you’re expecting to show, is.

    Thread Starter ValterTF

    (@valtertf)

    My bad, sorry – so that’s the admin menu.
    I deleted that 68 number, and now your plugin shows menu_position: "" , but there is no change in the admin menu. I tried disabling all other plugins, even Jetpack, and changed the active theme… but did not work either.
    Suggestions?

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Aha, part 2… show_in_menu_string: Cadastro is not correct. That field is not meant for adjusting/setting labels, it’s for specifying a parent menu item. For example, I created a post type based on the info above, and provided themes.php in that field, and my “Add Cadastro” menu item showed up as a submenu item in the “Themes” menu. That was actually probably conflicting more than the menu position, in immediate hindsight.

    From the WP documentation:

    (bool|string) Where to show the post type in the admin menu. To work, $show_ui must be true. If true, the post type is shown in its own top level menu. If false, no menu is shown. If a string of an existing top level menu (eg. ‘tools.php’ or ‘edit.php?post_type=page’), the post type will be placed as a sub-menu of that. Default is value of $show_ui.

    It may have been updated in description since I originally added our own help text.

    Thread Starter ValterTF

    (@valtertf)

    Yes, something was odd in the translation help text, but now it’s make sense. Not sure which file I should name there, but definitely should be a file and not a label. I left it blank and now it’s working! Like I said, I was sure it was me and not a bug, lol.
    Thanks a lot!

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Generally unless you’re intently putting your post type items in a specific spot, it’s best to leave that field blank.

    Good to hear you’re up and running now. ??

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Not showing in the admin bar’ is closed to new replies.