Custom Post Types: Custom columns with Title submenu?

I had a similar situation and I based myself on </wp-admin/includes/class-wp-posts-list-table.php>:499 (function single_row {…case ‘title’) Copy the $actions creation block, and associated variables, (which looks something like this) to your manage_{post_type}_posts_custom_column action: $post = get_post( $post_id ); setup_postdata( $post ); $title = _draft_or_post_title(); $post_type_object = get_post_type_object( $post->post_type ); $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); $actions … Read more

Adding new Post through Custom Post Type only offers me “Slug” as an option, how do I get more?

Did you add post-type support for those features, via add_post_type_support()? Use this format: <?php add_post_type_support( $post_type, $supports ) ?> The $supports argument is an array, that can include the following strings: ‘title’ ‘editor’ (content) ‘author’ ‘thumbnail’ (featured image) (current theme must also support Post Thumbnails) ‘excerpt’ ‘trackbacks’ ‘custom-fields’ ‘comments’ (also will see comment count balloon … Read more

Custom Post Type Templates?

First ofcourse we have single-<posttype>.php but I don’t think that’s what you want ( yay if it is ) To implement this, you would need a metabox, with a dropdown that saves the value to a custom field, which you would then pull from in single-<posttype>.php and then use in an include statement. single-.php would … Read more

Custom Post Type, limit to one

You can remove the ‘Add new’ submenu page like so: add_action( ‘admin_menu’, ‘myprefix_adjust_the_wp_menu’, 999 ); function myprefix_adjust_the_wp_menu() { //Get user id $current_user = wp_get_current_user(); $user_id = $current_user->ID; //Get number of posts authored by user $args = array(‘post_type’ =>’myposttype’,’author’=>$user_id,’fields’>’ids’); $count = count(get_posts($args)); //Conditionally remove link: if($count>1) $page = remove_submenu_page( ‘edit.php?post_type=myposttype’, ‘post-new.php?post_type=myposttype’ ); } A similar logic … Read more

Need idea: custom post type and custom meta

To get the users who have the role called student, use the WP_User_Query object For storing the fields, use post meta just as you would on normal posts, remember to declare that your custom post type supports custom fields when being registered For your dropdown/etc you will need to register metaboxes More info on WP_User_Query. … Read more