Ich habe einen neuen benutzerdefinierten Beitragstyp registriert, indem ich ihn fest in mein Thema codiert habe (ja, ich könnte/sollte dies in ein Plugin verschieben, das ich kenne!).
Aber wenn Sie den neuen Abfrageschleifenblock verwenden, sind die einzigen Optionen unter Beitragstyp „Beiträge“ und „Seiten“. Fehlt etwas in meinem CPT-Code, der dieses Problem verursacht, oder könnte es etwas anderes sein?
Danke im Voraus.
<?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' => __( 'Add New Listing', 'text_domain' ),
'add_new' => __( 'Add New Listing', 'text_domain' ),
'new_item' => __( 'New Listing', 'text_domain' ),
'edit_item' => __( 'Edit Listing', 'text_domain' ),
'update_item' => __( 'Update Listing', 'text_domain' ),
'view_item' => __( 'View Listing', 'text_domain' ),
'view_items' => __( 'View Listings', 'text_domain' ),
'search_items' => __( 'Search Listing', 'text_domain' ),
'not_found' => __( 'Not found', 'text_domain' ),
'not_found_in_trash' => __( 'Not found in Trash', 'text_domain' ),
'featured_image' => __( 'Featured Image', 'text_domain' ),
'set_featured_image' => __( 'Set featured image', 'text_domain' ),
'remove_featured_image' => __( 'Remove featured image', 'text_domain' ),
'use_featured_image' => __( 'Use as featured image', 'text_domain' ),
'insert_into_item' => __( 'Insert into listing', 'text_domain' ),
'uploaded_to_this_item' => __( 'Uploaded to this Listing', 'text_domain' ),
'items_list' => __( 'Listings list', 'text_domain' ),
'items_list_navigation' => __( 'Listings list navigation', 'text_domain' ),
'filter_items_list' => __( 'Filter listings list', 'text_domain' ),
);
$rewrite = array(
'slug' => 'listing',
'with_front' => true,
'hierarchical' => false,
);
$args = array(
'label' => __( 'Listing', 'text_domain' ),
'description' => __( 'Property Listings Custom Post Type', 'text_domain' ),
'labels' => $labels,
'supports' => array( 'title', 'editor', 'thumbnail', 'comments', 'revisions', 'custom-fields', 'page-attributes', 'author' ),
'taxonomies' => array(),
'hierarchical' => false,
'public' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 100,
'menu_icon' => 'dashicons-admin-multisite',
'show_in_admin_bar' => true,
'show_in_nav_menus' => true,
'can_export' => true,
'has_archive' => 'listings',
'exclude_from_search' => false,
'publicly_queryable' => true,
'capability_type' => 'post',
'rewrite' => $rewrite,
'capability_type' => array( 'listing', 'listings' ),
'map_meta_cap' => true,
);
register_post_type( 'post_type_listings', $args );
}
add_action( 'init', 'cpt_listings_function', 0 );