我正在尝试在wordpress中创建一个主题,我需要添加一个名为“发布”的另一个名为“投资组合”的页面,它将与帖子页面相同但使用/ portfolio / post-title的链接而不是/博客/ Headers 后 . 可能有这方面的教程,但我找不到任何具体到我在做什么 .
是的,有成千上万的教程,如果不是数百万 . 我假设你没有尝试过很多?您应该考虑的功能是“自定义帖子类型”
Example:
function codex_custom_init() { $labels = array( 'name' => 'Books', 'singular_name' => 'Book', 'add_new' => 'Add New', 'add_new_item' => 'Add New Book', 'edit_item' => 'Edit Book', 'new_item' => 'New Book', 'all_items' => 'All Books', 'view_item' => 'View Book', 'search_items' => 'Search Books', 'not_found' => 'No books found', 'not_found_in_trash' => 'No books found in Trash', 'parent_item_colon' => '', 'menu_name' => 'Books' ); $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 ); } add_action( 'init', 'codex_custom_init' );
资源:
http://codex.wordpress.org/Post_Types
http://codex.wordpress.org/Function_Reference/register_post_type
1 回答
是的,有成千上万的教程,如果不是数百万 . 我假设你没有尝试过很多?您应该考虑的功能是“自定义帖子类型”
Example:
资源:
http://codex.wordpress.org/Post_Types
http://codex.wordpress.org/Function_Reference/register_post_type