Archive page missing
-
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 .
- This topic was modified 5 years, 7 months ago by .
- This topic was modified 5 years, 7 months ago by .
The page I need help with: [log in to see the link]
The topic ‘Archive page missing’ is closed to new replies.