custom post types - Turning archive templates to a page template maintaining the slug

admin2025-06-06  1

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

转载请注明原文地址:http://conceptsofalgorithm.com/Algorithm/1749150824a316798.html

最新回复(0)