• Hi,
    I’m trying to develop a plugin with a top-level menu, and create meta boxes with WPAlchemy. My problems are pretty basic, but I can’t seem to find any resources for it.

    This is the current code I have:
    test.php

    // Hook for adding admin menus
    add_action('admin_menu', 'add_menu');
    
    // action function for above hook
    function add_menu() {
    // Add a new top-level menu:
    add_menu_page('Test Page Title','Test-Menu-Title','manage_options','test-slug', 'display_function');
    }
    function display_function() {
    	include 'test-page.php';
    }

    test-page.php is then used to generate the menu page for the plugin. I’m stuck with 2 problems:
    – How do I add WPAlchemy meta box on the menu page? It is added to the ‘Edit Post’ page by default.
    – If I would like to place all the code in the same file, what other options or are there, or what would be the best practice?

    I would appreciate any sort of help or links to references. Thanks.

Viewing 1 replies (of 1 total)
  • No clue on that WPAlchemy side, but you should wrap all of your code in classes and just call the methods when you need them. For example you should have an admin_page class that generates your HTML and just call that in your display_function function. Just make sure you require_once all of the class files before you call them.

Viewing 1 replies (of 1 total)
  • The topic ‘Plugin development’ is closed to new replies.