it-swarm.com.de

Warum wird der Editor im benutzerdefinierten Beitragstyp angezeigt?

Ich erstelle einen benutzerdefinierten Inhaltstyp und auf der Seite "Neue Seite hinzufügen" und "Seite bearbeiten" wird derzeit der Editor angezeigt, wenn ich ihn so codiert habe, dass er nicht vorhanden ist. Das hat vor einer Woche gut funktioniert und ich bin mir nicht sicher, was schief gelaufen ist. Irgendwelche Ideen?

Hier ist der Code von meiner Funktionsseite:

add_action('init', 'recipe_register');

function recipe_register() {
    $labels = array(
        'name' => _x('Recipes', 'post type general recipe'),
        'singular_name' => _x('Person', 'post type singular name'),
        'add_new' => _x('Add New Recipe', 'recipe'),
        'add_new_recipe' => __('Add New Recipe'),
        'edit_recipe' => __('Edit Recipe'),
        'new_recipe' => __('New Recipe'),
        'view_recipe' => __('View Recipe'),
        'search_recipes' => __('Search Recipes'),
        'not_found' =>  __('Nothing found'),
        'not_found_in_trash' => __('Nothing found in Trash'),
        'parent_item_colon' => ''
    );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array("slug" => "recipes"),
        'capability_type' => 'post',
        'hierarchical' => true,
        'menu_position' => null,
        'supports' => array('title','author','thumbnail')
      ); 


    register_post_type('recipe',$args);

    register_taxonomy('type','recipe',array(
        'hierarchical' => true,
        'label' => 'Type',
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => array( 'slug' => 'type' ),
    ));
}



add_action( 'init', 'create_post_type' );
function create_post_type() {
    register_post_type( 'recipe',
        array(
            'labels' => array(
                'name' => __( 'Recipe' ),
                'singular_name' => __( 'Recipe' )
            ),
            'public' => true,
            'has_archive' => true,
            'rewrite' => array('slug' => 'recipe')
        )
    );
}


add_action("admin_init", "admin_init");

function admin_init(){
    add_meta_box("recipedetails_meta", "Recipe Information", "recipe_meta",  "recipe", "normal", "low");
}

function recipe_meta() {
  global $post;
  $custom = get_post_custom($post->ID);
  $name = $custom["recipe_name"][0];
  $yield = $custom["recipe_yield"][0];
  $time = $custom["recipe_time"][0];
  $ingredients = $custom["recipe_ingredients"][0];
  $directions = $custom["recipe_directions"][0];
  $calories = $custom["recipe_calories"][0];
  $done = $custom["recipe_done"][0];
  $original = $custom["recipe_original"][0];
  ?>  

    <div id='peoplemanager_form_container'>

        <div id='shortanswers'>
            <p><label>Name</label><br /><input name="recipe_name" value="<?php echo $name; ?>"></p>
            <p><label>Yield</label><br /><input name="recipe_yield" value="<?php echo $yield; ?>"></p>
            <p><label>Time</label><br /><input name="recipe_time" value="<?php echo $time; ?>"></p>
            <p><label>Calories</label><br /><input name="recipe_calories" value="<?php echo $calories; ?>"></p>
            <p><label>URL</label><br /><input name="recipe_fat" value="<?php echo $done; ?>"></p>
            <p><label>Original</label><br /><input name="recipe_original" value="<?php echo $original; ?>"></p>
            <p><label>Ingredients:</label><br />
            <textarea cols="50" rows="5" name="recipe_ingredients"><?php echo $ingredients; ?></textarea></p>
            <p><label>Directions:</label><br />
            <textarea cols="50" rows="5" name="recipe_directions"><?php echo $directions; ?></textarea></p>

        </div>
    </div>
  <?php
}

add_action('save_post', 'save_details');

function save_details(){
  global $post;

  update_post_meta($post->ID, "recipe_name", $_POST["recipe_name"]);
  update_post_meta($post->ID, "recipe_yield", $_POST["recipe_yield"]);
  update_post_meta($post->ID, "recipe_time", $_POST["recipe_time"]);
  update_post_meta($post->ID, "recipe_ingredients", $_POST["recipe_ingredients"]);
  update_post_meta($post->ID, "recipe_directions", $_POST["recipe_directions"]);
  update_post_meta($post->ID, "recipe_calories", $_POST["recipe_calories"]);
  update_post_meta($post->ID, "recipe_done", $_POST["recipe_done"]);
}



add_filter('manage_edit-recipe_columns', 'add_recipe_columns');

function add_recipe_columns($gallery_columns) {
    $new_columns['cb'] = '<input type="checkbox" />';
    $new_columns['title'] = _x('Recipe', 'column name');
    $new_columns['calories'] = __('Calories');
    $new_columns['time'] = __('Time');
    $new_columns['type'] = __('Type');
    return $new_columns;
}


add_action('manage_recipe_posts_custom_column', 'manage_recipe_columns', 10, 2);

function manage_recipe_columns($column_name, $id) {
    global $post;
    switch ($column_name) {
        case 'calories':
            echo get_post_meta( $post->ID , 'recipe_calories' , true ); 
            break;
        case 'time': 
            echo get_post_meta( $post->ID, 'recipe_time' , true );
            break;
        case 'type':
            echo get_the_term_list($post->ID, 'type', '', ', ','');
            break;

        default:
            break;
    } 
}

?>
2
user4597

sie erhalten den Editor wegen der Funktion * create_post_type () * in Ihrem Code, den Sie oben gezeigt haben, es dupliziert die Funktion * recipe_register () * . Entfernen Sie einfach den * create_post_type * und alles sollte in Ordnung sein.

1
Amit Singh