Add new post type

  • Unknown's avatar

    Hi,
    – WordPress 3.6 :
    – PHP 5 / MySQL :
    – child theme of thirteen :
    – no extensions :
    – I use localhost :

    Problem :
    I do a blog with different type of post with personelize !
    I added in admin a new menu “recepies”.
    When I created a new recepies, I have a 404 error, why didn’t works ?
    this is my code :

    // Add new post type for Recipes
      4 add_action('init', 'cooking_recipes_init');
      5 function cooking_recipes_init()
      6 {
      7   $recipe_labels = array(
      8     'name' => _x('Recipes', 'post type general name'),
      9     'singular_name' => _x('Recipe', 'post type singular name'),
     10     'all_items' => __('All Recipes'),
     11     'add_new' => _x('Add new recipe', 'recipes'),
     12     'add_new_item' => __('Add new recipe'),
     13     'edit_item' => __('Edit recipe'),
     14     'new_item' => __('New recipe'),
     15     'view_item' => __('View recipe'),
     16     'search_items' => __('Search in recipes'),
     17     'not_found' =>  __('No recipes found'),
     18     'not_found_in_trash' => __('No recipes found in trash'),
     19     'parent_item_colon' => ''
     20   );
     21   $args = array(
     22     'labels' => $recipe_labels,
     23     'public' => true,
     24     'publicly_queryable' => true,
     25     'show_ui' => true,
     26     'query_var' => true,
     27     'rewrite' => true,
     28     'capability_type' => 'post',
     29     'hierarchical' => false,
     30     'menu_position' => null,
     31     'supports' => array('title','editor','comments')
     32   );
     33   register_post_type('recipes',$args);
     34 }

    Thank you

  • Unknown's avatar

    You did not specify a blog address or reason for posting when you created this topic.

    This support forum is for blogs hosted at WordPress.com. If your question is about a self-hosted WordPress blog then you’ll find help at the WordPress.org forums.

    If you don’t understand the difference between WordPress.com and WordPress.org, you may find this information helpful.

    If you forgot to include a link to your blog, you can reply and include it below. It’ll help people to answer your question.

    This is an automated message.

  • The topic ‘Add new post type’ is closed to new replies.