如何在自定义帖子类型中显示帖子格式?

时间:2015-06-03 13:06:04

标签: php wordpress wordpress-plugin custom-post-type

我在wordpress中创建自定义帖子类型。但我也想显示帖子格式引用和图像。我选择发布格式报价或图像。这是我的自定义帖子类型代码!

function Quotes_sky() {
    $labels = array(
        'name'               => _x( 'Quotes', 'post type general name', 'your-plugin-textdomain' ),
        'singular_name'      => _x( 'Quote', 'post type singular name', 'your-plugin-textdomain' ),
        'menu_name'          => _x( 'Quotes', 'admin menu', 'your-plugin-textdomain' ),
        'name_admin_bar'     => _x( 'Quote', 'add new on admin bar', 'your-plugin-textdomain' ),
        'add_new'            => _x( 'Add New', 'Quote', 'your-plugin-textdomain' ),
        'add_new_item'       => __( 'Add New Quote', 'your-plugin-textdomain' ),
        'new_item'           => __( 'New Quote', 'your-plugin-textdomain' ),
        'edit_item'          => __( 'Edit Quote', 'your-plugin-textdomain' ),
        'view_item'          => __( 'View Quote', 'your-plugin-textdomain' ),
        'all_items'          => __( 'All Quotes', 'your-plugin-textdomain' ),
        'search_items'       => __( 'Search Quotes', 'your-plugin-textdomain' ),
        'parent_item_colon'  => __( 'Parent Quotes:', 'your-plugin-textdomain' ),
        'not_found'          => __( 'No Quotes found.', 'your-plugin-textdomain' ),
        'not_found_in_trash' => __( 'No Quotes 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' => 'Quotes' ),
        'capability_type'    => 'post',
        'has_archive'        => true,
        'hierarchical'       => false,
        'menu_position'      => 5,
        'menu_icon'          => 'dashicons-editor-quote', 
        'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ) ,
        'taxonomies'         => array ( 'category', 'post_tag' )

        );

    register_post_type( 'Quotes Sky', $args );
}

这是屏幕短片。这有助于理解我的问题

enter image description here

1 个答案:

答案 0 :(得分:0)

'后格式'需要添加'支持'..可能是愚蠢的

'supports'           => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments', 'post-formats')