1
我已經創建了一個自定義帖子類型的WordPress與CPT UI名爲雞蛋。WordPress的自定義帖子類型單頁
在名爲eggs.php文件,我把這個代碼:
<?php
$args = array('post_type' => 'eggs');
$query = new WP_Query($args);
?>
<?php if ($query->have_posts()) : while($query->have_posts()) : $query->the_post(); ?>
<a href="<?php the_permalink(); ?>" Go to Eggs Single Page</a>
<?php endwhile; endif; wp_reset_postdata(); ?>
現在我已經創建了一個單eggs.php文件命名,並且當我點擊了永久重定向我在頁面上它說:「對不起,沒有帖子符合你的標準。」 。它不會像我想要的那樣進入頁面single-eggs.php。
編輯:目前我正在使用WebDevStudios的Custom Post Type UI插件。 當我使用OnTheGoSystems的Types插件時,它找到了single-template.php。也許這個插件有問題嗎?
我用另一個插件來使它工作,但我會考慮你的答案作爲將來使用它的一個好的解決方案。非常感謝你! –