• I have a custom post type called events and I’ve added a submenu item to it using the following code:

    add_action ('admin_menu', 'add_topic_menu');
        function add_topic_menu () {
            add_submenu_page( 'edit.php?post_type=events', 'Add New Topic', 'Add New Topic', 8, 'addnewtopic', 'create_topics_type' );
        }

    It shows up under the Events section as expected. As you can see I’m then calling a function called create_topics_type, which is calling another post type for which I’ve created a plugin (called Topics):

    function create_topics_type() {
    		register_post_type( 'topics',
    			array(
    				'labels' => array(
    					'name' => __( 'Topics' ),
    					'singular_name' => __( 'Topics' )
    				),
    			'public' => true,
    			'has_archive' => true,
    			'supports' => array(
    				'title',
    				'editor'
    			)
    			)
    		);
    	}

    Problem is that when I click on the new Add New Topic link under the events section nothing shows. I just get the wordpress chrome and the left menu and everything else is blank. I’m not sure the create_topics_type function is not getting called. I’ve just got some basic html in my plugin file so it should at least be showing that.

    Any ideas what I’m doing wrong?

    Thanks

  • The topic ‘Sub Menu item that calls a custom post type’ is closed to new replies.