• Resolved LearningDesigner

    (@learningdesigner)


    Hey there,

    I’m trying to make my very first Theme to send out for publishing.

    I got the ThemeCheck plugin and did a check-up.
    It gave me a few REQUIRED-tags.

    Most of them have been fixed, except for one.
    And I cannot find a good, clear way to get this solved.

    The ThemeCheck gives me this:
    REQUIRED: The theme uses the register_post_type() function, which is plugin-territory functionality.

    Can someone please explain me, perferably clearly, how I can solve this issue?

    Thank you all !

Viewing 1 replies (of 1 total)
  • Thread Starter LearningDesigner

    (@learningdesigner)

    Just to make it more specific:

    I have, regarding the register_post_type, this in my function.php

    // register custom post type 'my_custom_post_type'
    add_action( 'init', 'create_my_post_type' );
    function create_my_post_type() {
        register_post_type( 'my_custom_post_type',
          array(
            'labels' => array( 'name' => __( 'Products' ) ),
            'public' => true
        )
      );
    }

    and

    // Create 1 Custom Post type for a Demo, called HTML5-Blank
    function create_post_type_html5()
    {
        register_taxonomy_for_object_type('category', 'html5-blank'); // Register Taxonomies for Category
        register_taxonomy_for_object_type('post_tag', 'html5-blank');
        register_post_type('html5-blank', // Register Custom Post Type
            array(
            'labels' => array(
                'name' => __('HTML5 Blank Custom Post', 'html5blank'), // Rename these to suit
                'singular_name' => __('HTML5 Blank Custom Post', 'html5blank'),
                'add_new' => __('Add New', 'html5blank'),
                'add_new_item' => __('Add New HTML5 Blank Custom Post', 'html5blank'),
                'edit' => __('Edit', 'html5blank'),
                'edit_item' => __('Edit HTML5 Blank Custom Post', 'html5blank'),
                'new_item' => __('New HTML5 Blank Custom Post', 'html5blank'),
                'view' => __('View HTML5 Blank Custom Post', 'html5blank'),
                'view_item' => __('View HTML5 Blank Custom Post', 'html5blank'),
                'search_items' => __('Search HTML5 Blank Custom Post', 'html5blank'),
                'not_found' => __('No HTML5 Blank Custom Posts found', 'html5blank'),
                'not_found_in_trash' => __('No HTML5 Blank Custom Posts found in Trash', 'html5blank')
            ),
            'public' => true,
            'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages
            'has_archive' => true,
            'supports' => array(
                'title',
                'editor',
                'excerpt',
                'thumbnail'
            ), // Go to Dashboard Custom HTML5 Blank post for supports
            'can_export' => true, // Allows export in Tools > Export
            'taxonomies' => array(
                'post_tag',
                'category'
            ) // Add Category and Post Tags support
        ));
    }

    ____

    Please, I really need help on this one.

Viewing 1 replies (of 1 total)
  • The topic ‘ThemeCheck: register_post_type()’ is closed to new replies.