admin管理员组

文章数量:1130349

I used to have an archive-rooms.php (as page-rooms.php) template to list them all

This had few problems:

  • No title page
  • No way to synch menu item with title

so:

1) I duplicated the archive-rooms and prepended to it:

<?php
/*
Template Name: Rooms Template
*/
?>

2) Created page, assigned the template and set the slug from the post type to the page
3) Removed has_archive from the register_post_type() arguments

Now the problem, when I open the page the content is not what I expected, expecially the class of the body:

<body class="blog">

Which something like this I was expecting:

<body class="page page-id-xx page-template-rooms etc..">

Any explanation/suggestion for this issue?

Thanks

I used to have an archive-rooms.php (as page-rooms.php) template to list them all

This had few problems:

  • No title page
  • No way to synch menu item with title

so:

1) I duplicated the archive-rooms and prepended to it:

<?php
/*
Template Name: Rooms Template
*/
?>

2) Created page, assigned the template and set the slug from the post type to the page
3) Removed has_archive from the register_post_type() arguments

Now the problem, when I open the page the content is not what I expected, expecially the class of the body:

<body class="blog">

Which something like this I was expecting:

<body class="page page-id-xx page-template-rooms etc..">

Any explanation/suggestion for this issue?

Thanks

本文标签: custom post typesTurning archive templates to a page template maintaining the slug