Wordpress custom-posttype


Published on

Published in: Education, Technology, Business
  • Be the first to comment

  • Be the first to like this

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Wordpress custom-posttype

  1. 1. CUSTOM POST TYPE IN WORDPRESS By: Junejo Naeem Ahmed
  2. 2. 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.
  3. 3. 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
  4. 4. 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.
  5. 5. 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.
  7. 7. 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.
  8. 8. 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.
  9. 9. 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.
  10. 10. 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.
  11. 11. CUSTOM TAXONOMIES (cont’d)