WordPress自定义帖子类型,页面作为父级?

age*_*eto 5 wordpress

我的新WP项目中有很多自定义类型的项目,出于导航原因,我想让其中一些父项成为Wordpress页面.问题是,显然,Wordpress不允许您在具有不同帖子类型的项目之间建立父子关系.

无论如何都要覆盖这个?我正在使用Wordpress 3.1

BWD*_*ign 1

您需要帖子类型父级具有哪些“页面”功能?我猜您只是希望能够从后端编辑页面标题和内容。

如果是这种情况,请尝试以下操作:

  1. 为每种帖子类型创建自定义“档案”页面(http://codex.wordpress.org/Post_Types#Custom_Post_Type_Templates
  2. 在Wordpress中创建相应的页面来处理标题和内容
  3. 使用自定义存档模板,以编程方式告诉模板显示相应页面的标题和内容。

代码:

<?php $archive_post=get_post(YOUR_CORRESPONDING_PAGE_ID); ?>

<h1 class="entry-title"><?php echo apply_filters("the_title",$archive_post->post_title);?></h1>

<div class="entry-content"><?php echo apply_filters("the_content",$archive_post->post_content);?></div>
Run Code Online (Sandbox Code Playgroud)