我已经通过将其硬编码到我的主题中来注册了一个新的自定义帖子类型(是的,我可以/应该将其移动到我知道的插件中!)。
但是,当使用新的查询循环块时,帖子类型下的唯一选项是“帖子”和“页面”。我的 CPT 代码中是否缺少某些内容导致此问题,或者可能是其他原因?
提前致谢。
<?php
// Register Custom Post Type
function cpt_listings_function() {
$labels = array(
'name' => _x( 'Listings', 'Post Type General Name', 'text_domain' ),
'singular_name' => _x( 'Listing', 'Post Type Singular Name', 'text_domain' ),
'menu_name' => __( 'Listings', 'text_domain' ),
'name_admin_bar' => __( 'Listings', 'text_domain' ),
'archives' => __( 'Listing Archives', 'text_domain' ),
'attributes' => __( 'Listing Attributes', 'text_domain' ),
'parent_item_colon' => __( 'Parent Listing:', 'text_domain' ),
'all_items' => __( 'All Listings', 'text_domain' ),
'add_new_item' => __( …Run Code Online (Sandbox Code Playgroud)