• Resolved MPasc

    (@mpasc)


    hello,

    First of all: many thanks to all users that help others in this kind of forums!!

    I am writing because when I access to YOAST > Search Appearance > Archive, it only displays Author and Date archives and the 404 page in the special pages section.

    However, my theme has a custom type (Projects). I have checked the code and it is defined in the following way:

    // CPT projects
    function lo_cont_projects() {
      $labels = array(
        'name'               => __( 'Projects', 'offcours' ),
        'singular_name'      => __( 'Project', 'offcours' ),
        'add_new'            => __( 'Add new project', 'offcours' ),
        'add_new_item'       => __( 'Add new project', 'offcours' ),
        'edit_item'          => __( 'Edit project', 'offcours' ),
        'new_item'           => __( 'New project', 'offcours' ),
        'all_items'          => __( 'All projects', 'offcours' ),
        'view_item'          => __( 'View project', 'offcours' ),
        'search_items'       => __( 'Search project', 'offcours' ),
        'not_found'          => __( 'No found project', 'offcours' ),
        'not_found_in_trash' => __( 'No found project in trash', 'offcours' ),
        'menu_name'          => __( 'Projects', 'offcours' )
      );
      $args = array(
        'labels'        => $labels,
        'description'   => 'Projects items',
        'public'        => true,
        'show_ui'       => true,
        'menu_position' => 4,
        'menu_icon'     => 'dashicons-portfolio',
        'supports'      => array('title','thumbnail','editor'),
        'has_archive'   => true,
        'rewrite'       => array('slug' => __('projects', 'offcours' ))  
      );
      register_post_type( 'projects', $args );
    }
    add_action( 'init', 'lo_cont_projects' );

    The Custom type is defined as has_archive=true. According to the documentation of Yoast, whith this definition it should be displayed in the page.

    There is no page in wordpress for this archive, but in the file “arvhice.php” there is the following code:

    /* Start the Loop */
    while ( have_posts() ) : the_post();
    
        if( is_post_type_archive('projects') || is_tax('projectstypes') ):
    
            get_template_part( 'template-parts/content', 'projects' );
    
        else:
            get_template_part( 'template-parts/content', 'posts' );
    
        endif;
    
    endwhile;

    So, when the page /projects is called, it automatically shows the projects archive page ad the contents as they are defined in the template part.

    Could anybody help me to find why Yoast SEO is not displaying this custom type then?

    Thank you in advanced!!

    • This topic was modified 5 years, 7 months ago by MPasc.
    • This topic was modified 5 years, 7 months ago by MPasc.
    • This topic was modified 5 years, 7 months ago by MPasc.

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

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi @mpasc,

    Thank you for reaching out. We are sorry for the confusion here, but Custom Post Types settings are found under SEO → Search Appearance → Content Types. If the CPT is public, you should see a box with the post type name and when opened, you should be able to configure the archive defaults. See a screenshot here: https://snipboard.io/VCTYK8.jpg.

    We are going ahead and marking this issue as resolved due to inactivity. If you require any further assistance please create a new issue.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Archive page missing’ is closed to new replies.