• Resolved tchelocabral

    (@tchelocabral)


    My Custom Post Type page does not load my template.

    Here is the code for registering cpt:

    function cadastro_de_instituicoes(){
    // variáveis
    $nomeSingular = ‘Institui??o’;
    $nomePlural = ‘Institui??es’;
    $labels = array(
    ‘name’ => $nomePlural,
    ‘singular_name’ => $nomeSingular,
    ‘menu_name’ => $nomePlural,
    ‘name_admin_bar’ => $nomeSingular,
    ‘add_new’ => ‘Nova ‘ . $nomeSingular,
    ‘new_item’ => ‘Nova ‘ . $nomeSingular,
    ‘add_new_item’ => ‘Adicionar nova ‘ . $nomeSingular,
    ‘edit_item’ => ‘Editar ‘ . $nomeSingular,
    ‘view_item’ => ‘Visualizar ‘ . $nomeSingular,
    ‘all_items’ => ‘Todas as ‘ . $nomePlural,
    ‘search_items’ => ‘Procurar ‘ . $nomeSingular,
    ‘not_found’ => $nomePlural . ‘ n?o encontradas’
    );
    $supports = array(
    ‘title’,
    // ‘editor’,
    ‘thumbnail’
    );
    $args = array(
    ‘labels’ => $labels,
    ‘public’ => true,
    ‘publicly_queryable’ => true,
    ‘menu_position’ => 20,
    ‘menu_icon’ => ‘dashicons-admin-home’,
    ‘supports’ => $supports,
    ‘rewrite’ => array( ‘slug’ => ‘instituicao’ ),
    ‘has_archive’ => true
    );

    // registrando o PostType ‘instiuicao’
    register_post_type(‘instituicao’, $args);
    }
    // Chamando fun??o para adicionar o Post Type pelo método cadastro_de_instituicoes
    add_action(‘init’, ‘cadastro_de_instituicoes’); `
    `

    I created the files: single-instituicao.php and archive-instituicao.php

    But when creating a new Post Type of institution type, some pages appear as 404 and others without the single-institution template.php

    I went to Settings-> Permanent Links and clicked Save Changes.

    How do I get my Custom Post Type template from singleinstituicao.php?

    • This topic was modified 6 years, 10 months ago by tchelocabral.

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter tchelocabral

    (@tchelocabral)

    I see my error, i have an atribute with the same name ‘instituicao’.
    I change a “‘rewrite’ => array( ‘slug’ => ‘instituicao’ ),” to ‘rewrite’ => array( ‘slug’ => ‘instituicoes’ ), and my template work!

    tks

    Plugin Support Hannah S.L.

    (@fernashes)

    Automattic Happiness Engineer

    Thanks for updating and letting us know!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Problems with the Single Page of custom post type’ is closed to new replies.