質問

このサイトとWordPress Codexを読んでいます。WordPressでカスタムタイプのページを有効にする関数があることがわかります。ページを有効にするために同じことをするにはどうすればよいですか?

または、少なくとも、投稿をページの下に配置するために投稿が表示されるオプションを取得しますか?

役に立ちましたか?

解決

あなたの質問は理解のためにそれほど明確ではありません。とにかく、私は応答しようとします...新しいカスタム投稿タイプを宣言するときに「階層」=> trueを使用できます。

この新しいメニューを管理者の他の位置に配置するには、Proprety 'menu_position' => 5を使用します。

例(functions.phpファイルを追加する):

add_action( 'init', 'create_my_post_types' );    

function create_my_post_types() {
    register_post_type( 'mycustompages',
        array(
            'labels' => array(
                'name' => __( 'My custom pages' ),
                'singular_name' => __( 'My custom page' )
            ),
            'public' => true,
            'hierarchical' => true,
            'show_ui' => true,
            'publicly_queryable' => true,
            'exclude_from_search' => false,
            'menu_position' => 5,
            'supports' => array( 'title', 'editor', 'comments', 'trackbacks', 'author', 'excerpt', 'custom-fields', 'thumbnail' ),
            'rewrite' => array( 'slug' => 'mypage', 'with_front' => false ),
        )
    );
}
ライセンス: CC-BY-SA帰属
所属していません wordpress.stackexchange
scroll top