Inster a post into a subcategory on the nav with WordPress and PHP

0 Votes
    350 Views

I’m making a WordPress Template using HTML 5 Blank but my client want to insert into the nav a subcategory

something like this

enter image description here

But i don’t know how can I make it, i create a page of intenacionals and nationals and in my functions file i add this

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

// Create 1 Custom Post type for a Demo, called HTML5-Blank
function internacionales_post_type()
{
    register_taxonomy_for_object_type('category', 'html5-blank'); // Register Taxonomies for Category
    register_taxonomy_for_object_type('post_tag', 'html5-blank');
    register_post_type('internacionales', // Register Custom Post Type
        array(
        'labels' => array(
            'name' => __('Internacionales', 'html5blank'), // Rename these to suit
            'singular_name' => __('Internacionales', 'html5blank'),
            'add_new' => __('Add New', 'html5blank'),
            'add_new_item' => __('Add New Internacionales', 'html5blank'),
            'edit' => __('Edit', 'html5blank'),
            'edit_item' => __('Edit Internacionales', 'html5blank'),
            'new_item' => __('New Internacionales', 'html5blank'),
            'view' => __('View Internacionales', 'html5blank'),
            'view_item' => __('View Internacionales', 'html5blank'),
            'search_items' => __('Search Internacionales', 'html5blank'),
            'not_found' => __('No se encontraron Internacionales', 'html5blank'),
            'not_found_in_trash' => __('No se encontraron Internacionales en la papelera', 'html5blank')
        ),
        'public' => true,
        'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages
        'has_archive' => true,
        'menu_position' => 6,
        'supports' => array(
            'title',
            'editor',
            '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
    ));
}

So i whant to know what do i need to add to the function to make that the post belong to the tour national or international

at the moment the nav looks like this

enter image description here


Please signup or login to answer this question.