Benutzerdefinierter Beitragstyp, der als Seitenposttyp registriert wird

Ich habe Probleme, meinen benutzerdefinierten Beitragstyp korrekt zu registrieren. Es scheint sich als Seitenpostentyp zu identifizieren und diese Vorlage zu verwenden. Ich kann auch nicht auf die Archivseite zugreifen. Irgendeine Idee, was falsch ist?

add_action( 'init', 'register_cpt_women' ); function register_cpt_women() { $womenLabels = array( 'name' => _x( 'The Women', 'women' ), 'singular_name' => _x( 'The Women', 'women' ), 'add_new' => _x( 'Add New', 'women' ), 'add_new_item' => _x( 'Add New Woman', 'women' ), 'edit_item' => _x( 'Edit Woman', 'women' ), 'new_item' => _x( 'New Woman', 'women' ), 'view_item' => _x( 'View Woman', 'women' ), 'search_items' => _x( 'Search Women', 'women' ), 'not_found' => _x( 'No women found', 'women' ), 'not_found_in_trash' => _x( 'No women found in Trash', 'women' ), 'parent_item_colon' => _x( 'Parent Woman:', 'women' ), 'menu_name' => _x( 'The Women', 'women' ), ); $womenArgs = array( 'labels' => $womenLabels, 'hierarchical' => false, 'description' => 'The Women Listing', 'supports' => array( 'title', 'editor', 'thumbnail' ), 'public' => true, 'show_ui' => true, 'show_in_menu' => true, 'menu_position' => 6, 'menu_icon' => '/wp-content/themes/ssekoDesigns/assets/img/ico-jobs.png', 'show_in_nav_menus' => true, 'publicly_queryable' => true, 'exclude_from_search' => false, 'has_archive' => true, 'query_var' => true, 'can_export' => true, 'rewrite' => true, 'capability_type' => 'post' ); register_post_type( 'women', $womenArgs ); } 

Solutions Collecting From Web of "Benutzerdefinierter Beitragstyp, der als Seitenposttyp registriert wird"

Gehe zu Einstellungen> Permalinks und speichere deine Permalinks erneut. Wenn Sie einen Post-Typ initialisieren, müssen Sie Ihre Umschreibungsregeln aktualisieren.

Verwenden Sie diesen Code

 < ?php /* Testimonial */ function dyn_testimonial_post_tipe() { register_post_type( 'testimonial', array( 'label' => __('Testimonial'), 'singular_label' => __('testimonial Name'), '_builtin' => false, 'public' => true, 'show_ui' => true, 'show_in_nav_menus' => true, 'hierarchical' => true, 'capability_type' => 'page', 'menu_icon' => get_template_directory_uri() . '/lib/post-tipe/icon/testimonial.png', 'rewrite' => array( 'slug' => 'testimonial-view', 'with_front' => FALSE, ), 'supports' => array( 'title', 'editor', 'thumbnail') ) ); register_taxonomy('testimonial_category', 'testimonial', array( 'hierarchical' => true, 'label' => 'Testimonial Categories', 'singular_name' => 'Category', "rewrite" => true, "query_var" => true)); } add_action('init', 'dyn_testimonial_post_tipe'); // Add to admin_init function add_action('manage_testimonial_posts_custom_column' , 'custom_testimonial_columns', 10, 2); add_filter('manage_edit-testimonial_columns', 'my_testimonial_columns'); //Add columns for Testimonial posts function my_testimonial_columns($columns) { $columns = array( "cb" => "", "title" => "Title", "testimonial_categories" => "Categories", "comments" => "\"Comments\"/", "date" => "Date", ); return $columns; } function custom_testimonial_columns( $column, $post_id ) { switch ( $column ) { case 'testimonial_categories': $terms = get_the_term_list( $post_id , 'testimonial_category' , '' , ',' , '' ); if ( is_string( $terms ) ) { echo $terms; } else { echo 'Uncategorized'; } break; } } ?>