Skip to content

Submenu page #301

Closed
Closed

Description

@joneslloyd

Hi there,

I've seen how CMB2 can be used in admin menu pages (creating a theme options page, for example).

Just wondering if it's possible to use it on a pre-existing submenu page?

For example, I have a custom post type called 'faqs', and in the wordpress backend, hovering over the faqs top-level menu I'm able to "Add new faq", "View all faqs" and see "faq categories" - and want to add a submenu page ("faq settings").

I'd like to add CMB2 fields to this custom post type's submenu page.

Do you know if, as it stands, this can be done?

If the above can't be achieved, do you know if it's possible to create a submenu page with CMB2? (rather than adding CMB2 fields to an existing one).

Thanks!

Activity

  1. joneslloyd commented on Apr 23, 2015

    @joneslloyd
    Author

    I've actually figured out how to create a CMB2-only submenu page, so I'll close this.

    Thanks!

  2. alucav commented on Dec 23, 2017

    @alucav

    @joneslloyd care to share how you figured this out? You cluttered google with your question, but there's no solution. Boo.

  3. jtsternberg commented on Dec 23, 2017

    @jtsternberg
    Member

    You can see a commented-out example of setting to a submenu in the example-functions.php file:

    // 'parent_slug' => 'themes.php', // Make options page a submenu item of the themes menu.

    I've also added a couple examples to the snippet library: https://github.com/CMB2/CMB2-Snippet-Library/blob/master/options-and-settings-pages/submenu-options-pages.php

  4. jtsternberg commented on Dec 23, 2017

    @jtsternberg
    Member

    Also possibly helpful, snippet to show how to register a main options page with multiple submenu option pages: https://github.com/CMB2/CMB2-Snippet-Library/blob/master/options-and-settings-pages/options-pages-with-submenus.php
    Or, similar snippet but with added tabbed navigation among those menu pages: Doing submenu pages with tabbed navigation snippet can be found here: https://github.com/CMB2/CMB2-Snippet-Library/blob/master/options-and-settings-pages/options-pages-with-tabs-and-submenus.php

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions