php - 如何在 PHP 中管理博客文章 slug 标题之前的类别名称?

标签 php html css url seo

我看过很多博客并尝试过,但我想要别的东西。

我试过的博文网址 -

localhost/post/how-to-include-category-title-in-blog

同样

localhost/post/how-to-create-php-script

常见的是post页-----

我需要那个 - 假设我的博客中有三个类别——PHP、HTML、CSS

我在每个类别中创建帖子 - 所以 URL 应该是 -

localhost/php/what-is-php 

对于 CSS 帖子 -

localhost/css/what-is-css 

用于 HTML 帖子

localhost/html/what-is-html 

语法类似 -

localhost/category_name/post_title 

类别应该与帖子相关。

我需要删除帖子并希望它动态显示。

localhost/post/how-to-create-php-script

帖子是博客中的一个页面。我希望它根据这些 URL 进行删除和管理 -

localhost/php/what-is-php 


localhost/css/what-is-css 



localhost/html/what-is-html

我正在研究 PHP 核心。

最佳答案

您想熟悉 WP 管理中的 Parmalinks 页面。这是来自 WP 的文档:https://wordpress.org/support/article/settings-permalinks-screen/

根据您的需要,您可能想尝试自定义永久链接配置,例如:

/%category%/%postname%/

关于php - 如何在 PHP 中管理博客文章 slug 标题之前的类别名称?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57206805/

相关文章:

php - 自动版本控制静态内容

php - 使用 Guzzle 发布 blob

php - 在Memberpress中检查用户订阅类型

php - 如何在一次搜索中显示来自同一列的多列sql结果

html - 以不同的缩放级别或屏幕尺寸呈现元素

javascript - 切换播放/暂停图像按钮 HTML5 视频

css - 无法为二十一 Wordpress 主题的页脚添加我自己的背景

html - 如何使用 css 正确格式化表格

html - 使用 CSS attr() 函数和数据标签进行动画计时

html - 多列 css 破坏了 ul 内容问题