1

我创建了 2 个自定义帖子(帖子类型),并且正在尝试正确设置网址。

自定义页面 1“产品”包含产品
自定义页面 2“产品列表”包含从产品中挑选的产品列表。

当您创建产品列表时,您可以从自定义页面 1 中选择产品。
这种关系工作正常(使用 ACF pro 插件)并且产品在所有页面上都显示正确,只是 URL 错误。

文件
archive-productlist.php
single-productlist.php
single-product.php

当前网址结构:
example.com/productlist/some-list
example.com/product/some-product

应该是:
example.com/productlist/some-list/some-product

index.php?post_type=productlist&productlist=some-list-clicked&product=some-product-clicked

在单击产品链接并返回到 example.com/product/some-product 之前,该 URL 是有效的

函数.php

产品页面应该是这样的:

'has_archive'         => 'productlist',
‘rewrite’ => array(‘slug’=>’productlist/%thelist%/product’, ‘with_front’=> false),

产品列表页面当前是:

‘rewrite’ => array(‘slug’=>’productlist’,’with_front’=> false),

经过几天的摸索和搜索,我已经放弃了,所以有人能解释一下如何解决这个问题吗?

4

0 回答 0