A must have tool for creating custom fields, custom post types and taxonomies, fast and without any programming knowledge.
WordPress Creation Kit consists of three tools that can help you create and maintain custom post types, custom taxonomies and most importantly, custom fields and metaboxes for your posts, pages or CPT’s.
WCK Custom Fields Creator offers an UI for setting up custom meta boxes with custom fields for your posts, pages or custom post types. Uses standard custom fields to store data. You can show custom fields using code or with the Swift Templates module.
WCK Custom Post Type Creator facilitates creating custom post types by providing an UI for most of the arguments of register_post_type() function.
WCK Taxonomy Creator allows you to easily create and edit custom taxonomies for WordPress without any programming knowledge. It provides an UI for most of the arguments of register_taxonomy() function.
The WCK PRO version offers:
Premium Email Support for your project
http://www.cozmoslabs.com/wck-custom-fields-custom-post-types-plugin/
http://www.cozmoslabs.com/3747-wordpress-creation-kit-a-sparkling-new-custom-field-taxonomy-and-post-type-creator/
Let’s consider we have a meta box with the following arguments:
– Meta name: books
– Post Type: post
And we also have two fields defined:
– A text custom field with the Field Title: Book name
– And another text custom field with the Field Title: Author name
You will notice that slugs will automatically be created for the two text fields. For ‘Book name’ the slug will be ‘book-name’ and for ‘Author name’ the slug will be ‘author-name’
Let’s see what the code for displaying the meta box values in single.php of your theme would be:
<?php $books = get_post_meta( $post->ID, 'books', true ); foreach( $books as $book){ echo $book['book-name'] . '<br/>'; echo $book['author-name'] . '<br/>'; }?>
So as you can see the Meta Name ‘books’ is used as the $key parameter of the function get_post_meta() and the slugs of the text fields are used as keys for the resulting array. Basically CFC stores the entries as custom fields in a multidimensional array. In our case the array would be:
<?php array( array( "book-name" => "The Hitchhiker's Guide To The Galaxy", "author-name" => "Douglas Adams" ), array( "book-name" => "Ender's Game", "author-name" => "Orson Scott Card" ) );?>
This is true even for single entries.
You can create new queries to display posts from a specific post type. This is done via the ‘post_type’ parameter to a WP_Query.
Example:
<?php $args = array( 'post_type' => 'product', 'posts_per_page' => 10 ); $loop = new WP_Query( $args ); while ( $loop->have_posts() ) : $loop->the_post(); the_title(); echo '<div class="entry-content">'; the_content(); echo '</div>'; endwhile;?>
This simply loops through the latest 10 product posts and displays the title and content of them.
If you want to have a custom list in your theme, then you can pass the taxonomy name into the the_terms() function in the Loop, like so:
<?php the_terms( $post->ID, 'people', 'People: ', ', ', ' ' ); ?>
That displays the list of People attached to each post.
Creating a taxonomy generally automatically creates a special query variable using WP_Query class, which we can use to retrieve posts based on. For example, to pull a list of posts that have ‘Bob’ as a ‘person’ taxomony in them, we will use:
<?php $query = new WP_Query( array( 'person' => 'bob' ) ); ?>