Custom field/meta populated by dropdown of existing posts?

As the author of WPAlchemy, I’m a bit bias, but you essentially have a good working model outlined to follow depending on what ever route you choose.

However, if using WPAlchemy, you would basically do something like the following (step #2):

//  functions.php

include_once 'WPAlchemy/MetaBox.php';

if (is_admin()) 
{
    // a custom style sheet if you want to do some fancy styling for your form
    wp_enqueue_style('custom_meta_css', TEMPLATEPATH . '/custom/meta.css');
}

// define the meta box
$custom_metabox = new WPAlchemy_MetaBox(array
(
    'id' => '_custom_meta',
    'title' => 'My Custom Meta',
    'template' => TEMPLATEPATH . '/custom/meta.php'
));

custom/meta.css can contain styles that you can style your form with and custom/meta.php is essentially an HTML file with the FORM contents of the meta box, in this case your drop down, to generate your drop down you would do a custom wp query to get all your custom post types. WPAlchemy has some special helper functions to aid in creating your form elements.

There is additional documentation to assist you when working in the template.

The main goal of WPAlchemy was to keep control in the hands of the developer, from styling (look + feel) to meta box content definition.

And myself and others are always willing to help those who comment and ask questions.

Leave a Comment