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.

I need to create a Wordpress Custorm Post Type with the following fields, I am not a developer and would appreciate a cut and paste. The Fields are:

Contact Person, Address, Telephone, Cellphone, Fax, Email, Website

HELP

share|improve this question
    
...or try WordPress Custom Post Type Code Generator –  Michal Mau Jun 3 '11 at 9:35
2  
"majoring in wordpress development, graphic design for web and print" -zealmurapa.com –  Reigel Jun 3 '11 at 9:44

3 Answers 3

I think you have misunderstood what Custom Post Types are used for, if your trying to gather data try a plugin called Contact-Form-7 or if you want to post data then try using custom fields with the name of Contact Person, Address, Telephone, Cellphone, Fax, Email, Website.

You can echo custom fields into your theme files with the following code:

<?php $custom_field = get_post_meta($post->ID, 'custom-field-name', $single = true); ?>
<?php echo $custom_field  ?>

if you add a custom field called: 'contact-name' then you can setup the code to echo the data as follows;

<?php $contact_name = get_post_meta($post->ID, 'contact-name', $single = true); ?>
    <?php echo $contact_name ?>
share|improve this answer
    
Thanks Xavier, I understand the custom field format, but I want to register and display a new 'custom post type' and call it Organization, which will have posts with the above mentioned values (i.e. Contact Person, Address, Telephone, Cellphone, Fax, Email, Website.) and the title, content and featured image. Hope I have better explained myself, can you help? –  Zeal Apr 1 '11 at 11:33
    
Why do you need a custom post type? If you are a newbie to coding and wordpress i wouldn't recommend using Custom Post Types at all as they are much harder to work with, just add a category under Posts and name it "Organisations" then to all posts under "Organisations" just add custom fields to those posts All you have to do from there is query a category to display the data. –  Xavier Apr 1 '11 at 17:15
    
Also your website states the following majoring in wordpress development, graphic design for web and print So i have agree with @Roman Wünsche if you want someone to provide you the "majoring" that your website claims then pay a fee for it. –  Xavier Apr 1 '11 at 17:21

The easiest way for non developers to create custom post types is to use the Custom Post Type UI plugin.

That said, I don't think custom post types are what you really want, do you really want to show Person, Address, etc on separate pages? What are you actually trying to achieve?

share|improve this answer

You would need to add the custom post type in a plugin file, like this

add_action( 'init', 'create_post_type' );


function create_post_type() {

register_post_type('file', array(
    'label' => __('Organizations'), // e.g. apples
    'singular_label' => __('Organization'), // e.g. apple
    'public' => true,
    'show_ui' => true, // UI in admin panel
    '_builtin' => false, // It's a custom post type, not built in!
    '_edit_link' => 'post.php?post=%d',
    'capability_type' => 'post',
    'hierarchical' => false,
    'rewrite' => array("slug" => "YOURNAME"), // Permalinks format
    'supports' => array('title','author','custom-fields','comments' )
));

}

See for full possible options this page register post type

Then to add each field to the post type, you could use post meta.

add_post_meta($post_id, YOURMETANAME, YOURVALUE);
add_post_meta($post_id, 'Name', 'John Doe');

which you can retrieve with:

get_post_meta($post_id, YOURMETANAME, YOURVALUE);
get_post_meta($post_id, 'Name', 'John Doe');

This can't be done with simple copy/pasting, it will require some work from your side...

share|improve this answer
    
Thanks Jan, I managed to register the custom post, now I need the meta data for it, what's the next step, thanks for spoon feeding me. –  Zeal Apr 1 '11 at 14:41
2  
@Zeal: Don't get me wrong, but do you really expect that someone code the whole project for you? JanWillem give you some examples and suggestions. If you aren't a programmer, ask someone and pay a small fee for a solution. –  rofflox Apr 1 '11 at 15:26
1  
Your usage of __() is pointless: WordPress doesn’t have the string 'Organizations' in its default language file. –  toscho Jun 3 '11 at 10:17
1  
@Zeal see also metabox tag –  Michal Mau Jun 3 '11 at 11:52

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.