Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

Am attempting to create a custom post type and have it contain very specific info. Name, address, city, state, zip and photo - as a post. Need to have the admin section show form fields named as what these items are. Yes, I could use custom fields, however want to do it right and setup form input boxes (or meta boxes) for each specific piece of data.

Having the post creation dialog have a specific file upload input for the photo would be pretty smooth.

Will use plugins if necessary, however would rather code it in, as it is very specific (and should stay that way).

Looking for suggestions or tutorials that would cover this specific need, or plugins that anyone has used that do this.

share|improve this question

migrated from stackoverflow.com Jan 12 '12 at 0:51

This question came from our site for professional and enthusiast programmers.

add comment

1 Answer 1

Hi What you need to do is add some code to your functions.php file within your theme..

ie: register_post_type()

this will generate a new area under the likes of media on your admin menu.. the way you set this up, will depend on what is enabled and visible on the post write/edit pages..

for instance this is a copy paste from a theme file i have, this generates a new video post type,

add_action( 'init', 'register_videos_post_type' );

function register_videos_post_type() {
    register_post_type( 'videos',
        array(
            'labels' => array(
                'name' => __( 'Videos' ),
                'singular_name' => __( 'Video' ),
                'add_new' => __( 'Add New' ),
                'add_new_item' => __( 'Add New Video' ),
                'edit' => __( 'Edit' ),
                'edit_item' => __( 'Edit Video' ),
                'new_item' => __( 'New Video' ),
                'view' => __( 'View Video' ),
                'view_item' => __( 'View Video' ),
                'search_items' => __( 'Search Videos' ),
                'not_found' => __( 'No videos found' ),
                'not_found_in_trash' => __( 'No videos found in Trash' ),
                'parent' => __( 'Parent Video' ),
            ),
            'public' => true,
            'show_ui' => true,
            'publicly_queryable' => true,
            'show_in_nav_menus' => false,
            'exclude_from_search' => false,
            'hierarchical' => false,
            'rewrite' => array('slug'=>'video'),
            'supports' => array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'author'),
            'taxonomies' => array('post_tag')
        )
    );
flush_rewrite_rules();
}

this will enable a whole new video post type, which supports:

array('title', 'editor', 'excerpt', 'thumbnail', 'comments', 'author'),

have a read through the register_post_type()

hope this helps..

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.