Das Hinzufügen von CPT ändert das gesamte Layout meiner Site, mit Ausnahme des Archivs dieser CPT

Ich schreibe ein Plugin, das einen CPT namens Contest hinzufügt. Das Problem ist, dass das gesamte Layout der Seite geändert wird, wenn ich das Plugin aktiviere. Das Seltsame ist, dass die Änderungen auf alles angewendet werden, außer für das Wettbewerbsarchiv. Wenn ich das Plugin deaktiviere, kehrt die Site zum ursprünglichen Layout zurück. Ich verwende derzeit das Thema 2016. Um zu sehen, was ich meine, siehe unten …

Bildbeschreibung hier eingeben

Warum passiert das? Hier ist der Code für mein Plugin …

 'Contests', 'singular_name' => 'Contest', 'menu_name' => 'Contests', 'name_admin_bar' => 'Contest', 'add_new' => 'Add Contest', 'add_new_item' => 'New Contest', 'new_item' => 'New Contest', 'edit_item' => 'Edit Contest', 'view_item' => 'View Contest', 'all_items' => 'All Contests', 'search_items' => 'Search for a Contest', 'not_found' => 'There are no contests right now!', 'not_found_in_trash' => 'There are no contests in the trash right now!' ); $args = array( 'public' => true, 'labels' => $labels, 'publicly_queryable' => true, 'show_in_nav_menus' => true, 'menu_position' => 5, 'menu_icon' => 'dashicons-awards', 'query_var' => true, 'rewrite' => array('slug' => 'contests'), 'capability_type' => 'post', 'has_archive' => true, 'hierarchical' => false, 'supports' => array('thumbnail', 'title') ); register_post_type( 'contest', $args ); } add_action( 'init', 'imgw_cpts' ); function imgw_meta_boxes(){ add_meta_box( 'contest-dates', __('Running Dates'), 'imgw_dates_metabox', 'contest' ); add_meta_box( 'contest-description', __('Description/Rules'), 'imgw_description_editor', 'contest' ); } add_action( 'add_meta_boxes', 'imgw_meta_boxes' ); function imgw_dates_metabox($object){ wp_nonce_field(basename(__FILE__), "meta-box-nonce"); ?> 
<input type="date" name="contest-starting-date" value="ID, "contest-starting-date", true); ?>"> at <input type="time" name="contest-starting-time" value="ID, "contest-starting-time", true); ?>"> <input type="date" name="contest-ending-date" value="ID, "contest-ending-date", true); ?>"> at <input type="time" name="contest-ending-time" value="ID, "contest-ending-time", true); ?>">
post_type == 'contest') update_post_meta( $post->ID, 'contest-description', $_POST['contest-description'] ); update_post_meta( $post->ID, 'contest-starting-date', $_POST['contest-starting-date'] ); update_post_meta( $post->ID, 'contest-starting-time', $_POST['contest-starting-time'] ); update_post_meta( $post->ID, 'contest-ending-date', $_POST['contest-ending-date'] ); update_post_meta( $post->ID, 'contest-ending-time', $_POST['contest-ending-time'] ); } // end save_meta_data add_action('save_post', 'imgw_save_contest_meta', 10, 3); function imgw_contest_content( $content ){ global $post; if($post->post_type == 'contest'){ $content = "[imgw-contest id=\"".$post->ID."\"][/imgw-contest]"; return $content; } wp_die('Hello!'); } add_filter('the_content', 'imgw_contest_content'); function featured_image_requirement() { global $typenow; if("contest" == $typenow){ if(!has_post_thumbnail()) { //wp_die( 'You forgot to set the featured image. Click the back button on your browser and set it.' ); } } } add_action( 'pre_post_update', 'featured_image_requirement' ); add_filter( 'post_class', 'imgw_contest_class' ); function imgw_contest_class( $classes ) { /* Get the current post ID. */ $post_id = get_the_ID(); /* If we have a post ID, proceed. */ if ( !empty( $post_id ) ) { /* Get the custom post class. */ $post_class = get_post_meta( $post_id, 'contest-description', true ); /* If a post class was input, sanitize it and add it to the post class array. */ if ( !empty( $post_class ) ) $classes[] = sanitize_html_class( $post_class ); } return $classes; } function imgw_shortcodes( $atts ){ extract( $atts ); $starting_date = date(get_option('date_format'), strtotime(get_post_meta($id, 'contest-starting-date', true))); $starting_time = date(get_option('time_format'), strtotime(get_post_meta($id, 'contest-starting-time', true))); $ending_date = date(get_option('date_format'), strtotime(get_post_meta($id, 'contest-ending-date', true))); $ending_time = date(get_option('time_format'), strtotime(get_post_meta($id, 'contest-ending-time', true))); $description = get_post_meta($id, 'contest-description', true); $status_colors = array('Active' => 'green', 'Expired' => 'red', 'Pending' => 'gold'); ?>

at - at

<span style="color:">

Entries

<a href="https://wordpress.stackexchange.com/questions/221183/adding-cpt-changes-entire-layout-of-my-site-except-for-the-archive-of-that-cpt/">Submit Entry

$start && $now $end){ $status = 'Expired'; } else if($now

Solutions Collecting From Web of "Das Hinzufügen von CPT ändert das gesamte Layout meiner Site, mit Ausnahme des Archivs dieser CPT"