/**
* Register a custom post type called "book".
*
* @see get_post_type_labels() for label keys.
*/
function register_my_book_type() {
$labels = array(
'name' => 'Books'
'singular_name' => 'Book'
'menu_name' => 'Books'
...
);
$args = array(
'labels' => $labels,
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'book' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', ... ),
);
register_post_type( 'book', $args );
}
add_action( 'init', 'register_my_book_type' );
Themes must contain an index.php and a style.css
Generally they should be used to provide style and not functionality, but any PHP and hooks are available for developers to use.
Plugins have access to the same action hooks as themes, and typically contain functionality changes which might include default styles.
Plugins can also run code upon activation/deactivation
<?php
if ( have_posts() ) {
while ( have_posts() ) {
the_post();
//
// Post Content here
//
} // end while
} // end if
?>
the_title
the_permalink
the_content
get_header
get_footer
get_sidebar
wp_title
single_post_title
* almost
Key-value pairs containing data for posts. Can be managed by plugins or sometimes directly by administrators.
The same, but for users instead of posts.
(e.g. upon initialization of the plugin)
- Matt Mullenweg