最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Custom Post type page content (archive page)

programmeradmin1浏览0评论

I have website with multiple Custom post types and I need to create an Archive page for each post type that also has extra content (short description and the like). The way I would about this would be to create a normal Page, edit the template for that page to include the loop of posts and add the extra content/custom fields to that page. But that brings me to two issues:

  • What happens if I name the page the same name the Custom post type has? for example: "Services". Will my url /services point to the page or to the custom post "Services" archive?

  • Even if I name it something different I will have 2 different urls that have the list of the posts, one is the archive and the other is the page, that doesn't look great to me, right?

What would be the best way to approach this?

EDIT: This is my custom post type:

register_post_type( 'inspirer',
// CPT Options
    array(
        'labels' => array(
            'name' => __( 'Inspirer Posts' ),
            'singular_name' => __( 'Inspirer Post' )
        ),
        'menu_position' => 6,
        'public' => true,
        'has_archive' => true,
        'rewrite' => array('slug' => 'inspirer'),
        'show_in_rest' => true,
        'capability_type' => 'post',
        'hierarchical' => false,

    )
);
发布评论

评论列表(0)

  1. 暂无评论