• Hi there,

    I’ve been trying to get two post_types up – one is a page and the other is a post. I’ve referenced the Codex – http://codex.wordpress.org/index.php?title=Function_Reference/register_post_type

    But it doesn’t seem to accept this.
    I’ve tried various options but it doesn’t seem to accept the array for the second $args – do I have to rename this as $args1 or something?

    I’ve written:

    //time capsule //
    add_action( ‘init’, ‘create_post_type’ );
    function create_post_type() {
    $args = array (
    ‘labels’ => array (‘name’=>__(‘Time Capsule’),’singular_name’=> __(‘Time Capsule’)),
    ‘public’ => true,
    ‘has_archive’ => true,
    ‘rewrite’ => array (‘slug’ => __(‘evolution_flunkies_history’)),
    ‘publicly_queryable’ => true,
    ‘show_ui’ => true,
    ‘taxonomies’ => array (‘Time Capsule’,’1948 Consumer’, ‘2048 Today’, ‘2012 Walcha Know’, ‘Dark Age’, ‘Gasbagger’, ‘Datum’, ‘Science Tools’, ‘High Kicks’),
    ‘capability_type’ => ‘page’,
    ‘hierarchical’ => true,
    ‘query_var’ => true,
    ‘supports’ => (array ( ‘title’,
    ‘post_formats’,
    ‘editor’,
    ‘author’,
    ‘thumbnail’,
    ‘category’=> array (‘Time Capsule’,’1948 Consumer’, ‘2048 Today’, ‘2012 Walcha Know’, ‘Dark Age’, ‘Gasbagger’, ‘Datum’, ‘Science Tools’, ‘High Kicks’),
    ‘post_tags’,
    ‘excerpt’,
    ‘comments’,
    ‘page_attributes’,
    ‘custom_fields’,
    ‘slug’,
    ‘revisions’)),
    register_post_type(‘time_capsule’, $args))

    //gasbagger //

    register_post_type (‘gas’, $args)
    $args = ‘labels’ => array (
    ‘name’ => __(‘Gas’),
    ‘singular_name’ => __(‘Gas’)
    ),
    ‘public’ => true,

    ‘capability_type’ => ‘post’,
    ‘show_ui’ => true,
    ‘has_archive’ => true,
    ‘rewrite’ => array (‘slug’ => __(‘gas’)),
    ‘publicly_queryable’ => true,
    ‘taxonomies’ => array (‘Time Capsule’,’1948 Consumer’, ‘2048 Today’, ‘2012 Walcha Know’, ‘Dark Age’, ‘Gasbagger’, ‘Datum’, ‘Science Tools’, ‘High Kicks’),
    ‘hierarchical’ => true,
    ‘query_var’ => true,
    ‘supports’ => (array (‘title’,’post_formats’,’editor’,’author’,’thumbnail’,
    ‘categories’=> array (‘Time Capsule’,’1948 Consumer’, ‘2048 Today’, ‘2012 Walcha Know’, ‘Dark Age’, ‘Gasbagger’, ‘Datum’, ‘Science Tools’, ‘High Kicks’),
    ‘post_tags’,
    ‘excerpt’,
    ‘comments’,
    ‘page_attributes’,
    ‘custom_fields’,
    ‘slug’,
    ‘revisions’));
    )
    }

  • The topic ‘registering post_type using Codex’ is closed to new replies.