• Resolved Aaron T. Grogg

    (@aarontgrogg)


    At some point it became standard that WP Plugins use a “toplevel_page_” indicator in the Admin nav, such as the following example from icwp-wpsf:
    <li class="... toplevel_page_icwp-wpsf" id="toplevel_page_icwp-wpsf">
    <a href="..." class="... toplevel_page_icwp-wpsf" ...>...</a>
    </li>

    This allows custom a sort order to be applied to what is otherwise a chaotic navigation menu.

    Could you please add this standard to a near-future update?

    Thanks a lot,
    Atg

Viewing 8 replies - 1 through 8 (of 8 total)
  • Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Hello, Aaron.

    Thank you for contributing. We will check that.

    Regards.

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Hello.

    Can you explain a bit more? Our plugin has top-level menu.

    Regards.

    Thread Starter Aaron T. Grogg

    (@aarontgrogg)

    Hmm, this is how your plugin appears in my admin menu:

    <li class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-property menu-top-last" id="menu-posts-property">
      <a href="admin.php?page=all_properties" class="wp-has-submenu wp-not-current-submenu menu-top menu-icon-property menu-top-last" aria-haspopup="true">...</a>
      ...
    </li>

    I would expect the opening li to have a class and id, and the a to have a class, of something like “toplevel_page_wp-properties”, but I do not see that in my installation, with the latest updates…

    When comparing your plugin to all the plugins that do properly sort, the only difference I see is that all the others that use “admin.php?page=” as the base of the href also use something like “toplevel_page_” as a class and id for the li, and a class for the a

    The only other plugins that only use the same pattern that WP Properties uses either have something like “edit.php?post_type=” as the href or have their own page, like Tools or Users (tools.php or users.php).

    For example:
    https://aarontgrogg.com/lab/wp-properties-1.png

    Sorry if this seems trivial, but it means a lot to have a clean, organized menu for our clients…

    Thanks,
    Atg

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Ok, now is clear what do you mean. Can you please send a link to WordPress standards, which you mentioned, so we could follow them?

    Thread Starter Aaron T. Grogg

    (@aarontgrogg)

    Sure, I found this, third item, “Top level pages”:
    https://codex.wordpress.org/Plugin_API/Admin_Screen_Reference#Other_Pages

    Cheers,
    Atg

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    Unfortunately, that can be done because property is custom post type, which menu is created automatically like pages or posts menu items.

    Regards.

    Thread Starter Aaron T. Grogg

    (@aarontgrogg)

    Hmm, is it so different than other plugins, like Contact Form 7 for example?

    Their top-level link is:
    admin.php?page=wpcf7

    And their admin menu markup is:

    <li class="wp-has-submenu wp-has-current-submenu wp-menu-open menu-top toplevel_page_wpcf7" id="toplevel_page_wpcf7">
      <a href="admin.php?page=wpcf7" class="wp-has-submenu wp-has-current-submenu wp-menu-open menu-top toplevel_page_wpcf7" aria-haspopup="false">...</a>
    </li>

    (I don’t claim to understand the process, only pointing out similarities…)

    Thanks again,
    Atg

    Plugin Contributor MariaKravchenko

    (@mariakravchenko)

    I have spoken with our developers and they underlined that WP-Property plugin is not usual, it is working with post type, but with its own custom. For that reason, its menu is like default Posts menu.

    E.g we have other plugins like WP-CRM and WP-Invoice and there we use toplevel_page_ .

    Regards.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘toplevel_page_ missing in admin nav’ is closed to new replies.