【发布时间】:2020-09-03 14:48:28
【问题描述】:
我不知道这是否可能,但我想配置一个 WordPress 网站,为所有匹配 https://example.com/things/<any_word> 格式的 URL 呈现相同的页面,该 URL 必须保持其值。
例如,
以下网址必须显示相同的内容:
非常感谢您的帮助
【问题讨论】:
我不知道这是否可能,但我想配置一个 WordPress 网站,为所有匹配 https://example.com/things/<any_word> 格式的 URL 呈现相同的页面,该 URL 必须保持其值。
例如,
以下网址必须显示相同的内容:
非常感谢您的帮助
【问题讨论】:
有几种选择:
1) 注册您的自定义帖子类型并创建默认模板(最佳选择)
2) 向页面模板(single.php 或 page.php ...)添加一些自定义代码,您可以在其中调用特定类别的特定模板:
<?php
if (get_the_category(get_the_id())=='your-category')
{
get_template_part( 'TEMPLATE_FOLDER/content', 'something' ); // "content-something.php"
} ?>
https://developer.wordpress.org/themes/template-files-section/page-template-files/ https://developer.wordpress.org/reference/functions/register_post_type/
【讨论】: