Title: Plugin development
Last modified: August 20, 2016

---

# Plugin development

 *  [JamiesWright](https://wordpress.org/support/users/jamieswright/)
 * (@jamieswright)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-development-7/)
 * 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)

 *  [markparolisi](https://wordpress.org/support/users/markparolisi/)
 * (@markparolisi)
 * [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-development-7/#post-2721447)
 * 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.

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 1 reply
 * 2 participants
 * Last reply from: [markparolisi](https://wordpress.org/support/users/markparolisi/)
 * Last activity: [14 years, 1 month ago](https://wordpress.org/support/topic/plugin-development-7/#post-2721447)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
