jaredatch/Custom-Metaboxes-and-Fields-for-WordPress — Issue #51: add() function called before Wordpress includes template.php
Author: jasondavis
Created: 2011-12-10 16:43:33+00:00
State: open

The steps I did...

1. I copied the metaboxes folder to my themes folder like this `theme/lib/metaboxes/`
2. I copied the code from `example-functions.php` into my own `theme/functions.php` file.
3. in my `theme/functions.php` I included the path to `theme/lib/metaboxes/init.php`
4. Then I tried loading a "Add Page" wordpress

Now it did not work, so I did some debugging and realized it was trying to include my paths wrong for the javascript and css files, because I am on Windowswith XAMPP. I made some changes and resolved that.

Now my next problem was in the `add()` function in `init.php` it was trying to lod this add function before Wordpress included the template.php page, so I had to add to the `add()` function this code....

if (!function_exists('add_meta_box')) include(WP_CONTENT_DIR.'/../wp-admin/includes/template.php');

Now I have it all working but I had to make those changes out of the box, this doesn't seem right, any ideas on why I had to do this and is it something that can be resolved better?