Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- add_action('init', 'create_foo');
- function create_foo() {
- $foo_args = array(
- 'label' => __('Foo'),
- 'singular_label' => __('Foo'),
- 'public' => true,
- 'show_ui' => true,
- 'capability_type' => 'post',
- 'hierarchical' => true,
- 'rewrite' => true,
- 'supports' => array('title', 'editor', 'excerpt', 'thumbnail')
- );
- register_post_type('foo',$foo_args);
- }
- add_action("admin_init", "add_foo");
- add_action('save_post', 'update_website_url');
- function add_foo(){
- add_meta_box("foo_details", "Foo Options", "foo_options", "foo", "normal", "low");
- }
- function foo_options(){
- global $post;
- if (isset($custom['website_url']) && isset($custom['website_url'][0])) {
- $website_url = isset($custom['website_url']) ? $custom['website_url'][0] : '';}
- ?>
- <div id="foo-options">
- <label>Website URL:</label><input name="website_url" value="<?php echo $website_url; ?>" />
- </div><!--end foo-options-->
- <?php
- }
- {
- function update_website_url(){
- global $post;
- if (($post != null) && isset($_POST['website_url'])) {
- update_post_meta($post->ID, "website_url", $_POST["website_url"]);
- }
- }
- add_filter("manage_edit-foo_columns", "foo_edit_columns");
- add_action("manage_posts_custom_column", "foo_columns_display");
- function foo_edit_columns($foo_columns){
- $foo_columns = array(
- "cb" => "<input type=\"checkbox\" />",
- "title" => "Project Title",
- "description" => "Description",
- );
- return $foo_columns;
- }
- function foo_columns_display($foo_columns){
- switch ($foo_columns)
- {
- case "description":
- the_excerpt();
- break;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement