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 am creating a plugin to standardize things in creating themes, I include a 'post type generator' in the plugin, but I've been seeing some are very complicated, I would like to create something very simple something like:

With three fields, slug, singular, plural and a field 'checkbox' category for yes or no, he wanted to send the form and register these functions also listasse the post type, because I usually work with many post-types.
Follows the code:

///////////////////////////////////////////////////
///////////// FORM FOR GENERATE POST TYPE
///////////////////////////////////////////////////

<form method="post" id="cpt-creator" action="">
<?php settings_fields( 'hyperbolic_opcoes' ); do_settings_sections( 'hyperbolic_opcoes' );?>

<table class="form-table hyperbolic-table">

<tr>
<th>Slug <span class="required">*</span></th>
<td><input type="text" id="pt_slug" name="pt_slug" value="" placeholder="Slug do Post Type"></td>
</tr>

<tr>
<th>Label Singular <span class="required">*</span></th>
<td><input type="text" id="pt_singular" name="pt_singular" value="" placeholder="Labels Singular"></td>
</tr>

<tr>
<th>Label Plural <span class="required">*</span></th>
<td><input type="text" id="pt_plural" name="pt_plural" value="" placeholder="Labels Plural"></td>
</tr>

<tr>
<th><label for="pt_cat">Show Taxonomies</label></th>
<td><input type="checkbox" id="pt_cat" name="pt_cat" value="pt_cat_yes" /></td>
</tr>

</table>
<p class="submit"><input type="submit" id="send-pt" name="send-pt" value="Criar Post Type" class="button button-primary" /></p>

</form>
////////////////////////////////////////////////////////////////////////////////
//////////////// END FORM POST TYPE GENERATOR
////////////////////////////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////
////////////// TABLE LIST OF POSTS TYPES
///////////////////////////////////////////////////////////
<table class="ctpalls" cellpadding="0" cellspacing="0">
<tr>
<th class="pt-number">#</th>
<td class="pt-slug">Post Type Slug</td>
<td class="pt-sing">Post Type Label Singular</td>
<td class="pt-plur">Post Type Label Plural</td>
<td class="pt-taxo">Taxonomies</td>
</tr>

<th class="pt-number">1</th>
<td class="pt-slug">products</td>
<td class="pt-sing">Product</td>
<td class="pt-plur">Products</td>
<td class="pt-taxo">NO TAX</td>
</tr>
</table>
///////////////////////////////////////////////////////////
////////////// END TABLE LIST OF POSTS TYPES
///////////////////////////////////////////////////////////

Something like this.

share|improve this question
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.