Option template does not show on wordpress custom page

Asked

Viewed 352 times

1

I am creating a new tab equal to "page" however, separate, staying as the image. inserir a descrição da imagem aqui

The problem is that I created a custom template, I created my theme myself, in the "pages" tab appears the template option

inserir a descrição da imagem aqui

Only that in this tab "Locations" that I created does not appear the template option, someone knows how to put?

Follow the code of the Registry.

function locations_register(){
    $labels = array(
        'name' => _x('Locations','post type general name'),
        'singular_name' => _x('Locations', 'post type singular name'),
        'add_new' => _x('Add new location', 'location'),
        'add_new_item' => __('Add new location'),
        'edit_item' => __('Edit location'),
        'new_item' => __('New location'),
        'view_item' => __('View location'),
        'search_items' => __('Search location'),
        'not_found' => __('Nothing Result'),
        'not_found_in_trash' => __('Nothing result on the bin'),
        'parent_item_colon' => ''
        );

    $args = array(
        'labels' => $labels,
        'public' => true,
        'publicly_queryable' => true,
        'show_ui' => true,
        'query_var' => true,
        'rewrite' => true,
        'has_archive' => false,
        'capability_type' => 'page',
        'hierarchical' => true,
        'menu_position' => 4,
        'taxonomies'=> array('features'),
        'supports' => array('title','thumbnail','editor','page-attributes') 
        );

    register_post_type('location', $args);      
}

1 answer

1

If I’m not mistaken, it’s not allowed in any kind of custom post, this has not been implemented because custom posts can be named using the default WP hierarchy.

For example, you are creating a publication type called Location, you can create a template called single-Location.php, it will apply the template only to custom posts of this type.. This applies to almost everything..

Another example, Archive-Location.php applies to the file page.

You can even add page-{post-id}. php to create a template for a specific page... and so on.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.