Last active
October 13, 2015 04:08
-
-
Save jesgs/4137028 to your computer and use it in GitHub Desktop.
WordPress Post-Type Framework Example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action('init', 'theme_post_types'); | |
/** | |
* Reqister Post-Types | |
* | |
* @return void | |
*/ | |
function theme_post_types() | |
{ | |
//example #1: | |
$videos = new JesGS_PostType(); | |
$videos | |
->set_name('mytheme_videos') | |
->set_singlename('Video') | |
->set_pluralname('Videos') | |
->set_arguments() | |
->init(); | |
// example #2: | |
// init() method is called automatically | |
$books = new JesGS_PostType(array( | |
'name' => 'mytheme_books', | |
'singlename' => 'Book', | |
'pluralname' => 'Books', | |
'arguments' => array( | |
'supports' => array( | |
'title', | |
'editor', | |
), | |
'has_archive' => true, | |
'rewrite' => array( | |
'slug' => 'books', | |
), | |
), | |
)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment