Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/266.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 单个自定义柱类型的多段塞_Php_Wordpress_Custom Post Type - Fatal编程技术网

Php 单个自定义柱类型的多段塞

Php 单个自定义柱类型的多段塞,php,wordpress,custom-post-type,Php,Wordpress,Custom Post Type,我正试图使一个自定义的帖子类型具有多个归档段塞 当前重写: 'rewrite' => array('slug' => 'blog/authors', 'with_front' => false ), 我希望在同一个CPT下有多个列表。我正在寻找这种功能: 'rewrite' => array('slug' => array('blog/authors', 'our-people'), 'with_front' => false ), 这可能吗?我现在假设我

我正试图使一个自定义的帖子类型具有多个归档段塞

当前重写:

'rewrite' => array('slug' => 'blog/authors', 'with_front' => false ),
我希望在同一个CPT下有多个列表。我正在寻找这种功能:

'rewrite' => array('slug' => array('blog/authors', 'our-people'), 'with_front' => false ),
这可能吗?我现在假设我必须编写一些自定义重写规则,尽管我希望有一个干净的解决方案

通过搜索,我找到了以下链接,但没有一个对我的情况有帮助:

无益

没办法

具体语言


谢谢

在使用钩子检查url后,您可以在页面加载时重写帖子类型url:

register_post_type( 
    'products', 
    array (
        'rewrite' => array (
            'slug' => _x( 'products', 'URL slug', 'your_text_domain' )
        )
    )
);

在使用钩子检查url后,可以在页面加载时重写帖子类型url:

register_post_type( 
    'products', 
    array (
        'rewrite' => array (
            'slug' => _x( 'products', 'URL slug', 'your_text_domain' )
        )
    )
);

您是否介意根据您的原始问题添加一个示例,说明这是如何工作的?你是如何让slug成为博客/作者和我们的人的?我相信我所做的是基于
$\u SERVER['REQUEST\u URI']
检查URL,如果它包含关键字,我会将其重写到新的URL。我希望这对mate至少有一点帮助!您是否介意根据您的原始问题添加一个示例,说明这是如何工作的?你是如何让slug成为博客/作者和我们的人的?我相信我所做的是基于
$\u SERVER['REQUEST\u URI']
检查URL,如果它包含关键字,我会将其重写到新的URL。我希望这对mate至少有一点帮助!