【问题标题】:Display Custom Post Type within a page template in Wordpress在 Wordpress 的页面模板中显示自定义帖子类型
【发布时间】:2014-01-15 08:24:39
【问题描述】:

我正在使用 custom post type plugin 为我的 Wordpress 网站创建自定义帖子类型。

我想将自定义帖子类型添加到页面模板。但是,当我添加 php 循环来调用我创建的自定义帖子类型时,它会改为调用页面内容。

有谁知道如何解决这个问题?谢谢。

【问题讨论】:

标签: wordpress custom-post-type


【解决方案1】:

在循环之前试试这个:

<?php query_posts(array('post_type' => 'your-cpt-name') ); ?>

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-11-07
    • 1970-01-01
    相关资源
    最近更新 更多