【发布时间】:2015-10-06 12:21:46
【问题描述】:
我有 wordpress 的自定义帖子类型。
http://localhost/wordpress/photos/
http://localhost/wordpress/photos/my-photo
为什么这些 url 返回 404 not found ?
如何为此制作存档文件?
喜欢 :
archive-photos.php(我在目录中有这个,但是...)
function register_gallery(){
register_post_type( 'photos', array(
'public' => true,
'menu_position' => 10,
'menu_icon' => 'dashicons-format-gallery',
'supports' => array( 'title', 'editor', 'thumbnail'),
'has_archive' => true,
));
}
add_action('init','register_gallery');
【问题讨论】:
-
我建议,参考woocommerce,产品是自定义帖子。我已经为自定义产品类型做过。
-
我没有使用任何插件!
-
如何在设置 > 阅读中设置永久链接?
-
我没有让你使用插件,我只是让你参考,你可以在你的主题文件夹中使用模板。即使你知道,你可以在你的主题文件夹中使用 woocommerce 模板,就像为您的帖子类型制作自定义模板并在您的主题文件夹中使用它。
-
永久链接已解决