• Resolved LarsKumbier

    (@larskumbier)


    I have registered a custom post type and would like to add entries of this CPT into my menu. I have multiple users with the Admin Role, but they only show up under one specific user – the others simply don’t see the Custom Post Types.

    // functions.php
        function register_cpt_trainings() {
    
            $labels = array(
                'name'                => _x( 'Trainings', 'Post Type General Name', 'somedomain' ),
                'singular_name'       => _x( 'Training', 'Post Type Singular Name', 'somedomain' ),
                'menu_name'           => __( 'Trainings', 'somedomain' ),
                'parent_item_colon'   => __( 'Eltern Training:', 'somedomain' ),
                'all_items'           => __( 'Alle Trainings', 'somedomain' ),
                'view_item'           => __( 'Training anzeigen', 'somedomain' ),
                'add_new_item'        => __( 'Training hinzufügen', 'somedomain' ),
                'add_new'             => __( 'hinzufügen', 'somedomain' ),
                'edit_item'           => __( 'Training bearbeiten', 'somedomain' ),
                'update_item'         => __( 'Training aktualisieren', 'somedomain' ),
                'search_items'        => __( 'Durchsuche Trainings', 'somedomain' ),
                'not_found'           => __( 'Nicht gefunden', 'somedomain' ),
                'not_found_in_trash'  => __( 'Nicht im Papierkorb gefunden', 'somedomain' ),
            );
            $args = array(
                'label'               => __( 'trainings', 'somedomain' ),
                'description'         => __( 'Trainings', 'somedomain' ),
                'labels'              => $labels,
                'supports'            => array( 'title', 'editor', ),
                'taxonomies'          => array( 'category' ),
                'hierarchical'        => false,
                'public'              => true,
                'show_ui'             => true,
                'show_in_menu'        => true,
                'show_in_nav_menus'   => true,
                'show_in_admin_bar'   => true,
                'menu_position'       => 5,
                'can_export'          => true,
                'has_archive'         => false,
                'exclude_from_search' => false,
                'publicly_queryable'  => true,
                'capability_type'     => 'page'
            );
            register_post_type( 'trainings', $args );
        }

    Unter Design / Menu, I expect them to show up on all admin users, but the other ones only have the default entries “posts”, “page”, “links” and “categories”.

    My user also has the “training”.

    Any ideas?

Viewing 3 replies - 1 through 3 (of 3 total)
  • Here are the codex default args from http://codex.wordpress.org/Function_Reference/register_post_type
    Probably a good place to start…

    add_action( 'init', 'codex_book_init' );
    /**
     * Register a book post type.
     *
     * @link http://codex.wordpress.org/Function_Reference/register_post_type
     */
    function codex_book_init() {
    	$labels = array(
    		'name'               => _x( 'Books', 'post type general name', 'your-plugin-textdomain' ),
    		'singular_name'      => _x( 'Book', 'post type singular name', 'your-plugin-textdomain' ),
    		'menu_name'          => _x( 'Books', 'admin menu', 'your-plugin-textdomain' ),
    		'name_admin_bar'     => _x( 'Book', 'add new on admin bar', 'your-plugin-textdomain' ),
    		'add_new'            => _x( 'Add New', 'book', 'your-plugin-textdomain' ),
    		'add_new_item'       => __( 'Add New Book', 'your-plugin-textdomain' ),
    		'new_item'           => __( 'New Book', 'your-plugin-textdomain' ),
    		'edit_item'          => __( 'Edit Book', 'your-plugin-textdomain' ),
    		'view_item'          => __( 'View Book', 'your-plugin-textdomain' ),
    		'all_items'          => __( 'All Books', 'your-plugin-textdomain' ),
    		'search_items'       => __( 'Search Books', 'your-plugin-textdomain' ),
    		'parent_item_colon'  => __( 'Parent Books:', 'your-plugin-textdomain' ),
    		'not_found'          => __( 'No books found.', 'your-plugin-textdomain' ),
    		'not_found_in_trash' => __( 'No books found in Trash.', 'your-plugin-textdomain' )
    	);
    
    	$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', 'author', 'thumbnail', 'excerpt', 'comments' )
    	);
    
    	register_post_type( 'book', $args );
    }

    Thread Starter LarsKumbier

    (@larskumbier)

    Solution: You have to enable the CPTs in the admin options at the top of the screen. see http://wordpress.stackexchange.com/a/37801/9241

    Very Good, Yes, the Screen Options … I see now you had the show_in_menu and show_in_nav_menus both true. Please mark the topic resolved?

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘CPTs don't show up at all users?’ is closed to new replies.