+ All Categories
Home > Education > Wordpress custom-posttype

Wordpress custom-posttype

Date post: 01-Nov-2014
Category:
Upload: naeem-junejo
View: 795 times
Download: 0 times
Share this document with a friend
Description:
 
11
CUSTOM POST TYPE IN WORDPRESS By: Junejo Naeem Ahmed
Transcript
Page 1: Wordpress custom-posttype

CUSTOM POST TYPE IN WORDPRESS

By:Junejo Naeem Ahmed

Page 2: Wordpress custom-posttype

POST TYPES

• WordPress can hold and display many different types of content.

• A single item of such a content is generally called a post.

• although post is also a specific post type.• Internally, all the post types are stored in the same

place, in the wp_posts database table, but are differentiated by a column called post_type.

• WordPress 3.0 gives you the capability to add your own custom post types and to use them in different ways.

Page 3: Wordpress custom-posttype

DEFAULT POST TYPES

• There are five post types that are readily available to users or internally used by the WordPress installation by default :– Post– Page– Attachment– Revision– Navigation menu

Page 4: Wordpress custom-posttype

WHAT ACTUALLY ARE CUSTOM POST TYPES?

• By using Custom Post Types you can create a new type of item like Posts and Pages, which will contain a different set of data.

• It will have a new administration menu, dedicated editing pages, custom taxonomies and many more utilities required for full fledged publishing.

• Custom Post Types are a new set of administrative options appearing along with the default post types such as Posts, Pages, Attachments etc.

Page 5: Wordpress custom-posttype

WHAT ACTUALLY ARE CUSTOM POST TYPES? (cont’d)

• A Custom Post Type can store any type of information. It has a dedicated editor, media uploader and uses the existing WordPress table structure for ease in data management.

• The main advantage of creating custom post types using the WordPress API is that it equips itself well with existing themes and templates.

• Custom Post Types are also SEO friendly because of their nifty permalinks.

Page 6: Wordpress custom-posttype

WHAT ACTUALLY ARE CUSTOM POST TYPES? (cont’d)

Page 7: Wordpress custom-posttype

CUSTOM POST TYPES

• Custom post types are new post types you can create.

• A custom post type can be added to WordPress via the register_post_type() function.

• This function allows you to define a new post type by its labels, supported features, availability and other specifics.

• Note that you must call register_post_type() before the admin_menu and after the after_setup_theme action hooks.

• A good hook to use is the init hook.

Page 8: Wordpress custom-posttype

WHAT WORDPRESS CAN DO FOR YOU NOW

• You could create custom post types for books, movies, reviews, products and so on.

• If created correctly, you can achieve the following with a few lines of code:

• The custom post type will show up in the back end as a separate menu item with its own post list and “add new” page.

• Categories and tags can be made available to the custom post type, or you can create custom taxonomies.

Page 9: Wordpress custom-posttype

WHAT WORDPRESS CAN DO FOR YOU NOW

• Apart from these, you can modify countless options, such as where the custom post type should be placed in the menu, should it be searchable, which user level can access it, should it be hierarchical, custom rewrite rules, etc.

• Custom meta boxes enable you to add additional boxes to the edit screen of a post. They usually use custom fields, so you could just use custom fields as well, but by separating out some custom fields as meta boxes, you can create a much smoother and usable admin.

Page 10: Wordpress custom-posttype

CUSTOM TAXONOMIES

• Custom Taxonomies Your regular blog posts use categories and tags to create an organization structure.

• However, the same organization doesn’t necessarily make sense for custom post types.

• Your blog posts could be about your “Life,” your “Thoughts” or your “Dreams.”

• These are obviously not appropriate for products.

Page 11: Wordpress custom-posttype

CUSTOM TAXONOMIES (cont’d)


Recommended