php - 当我在我的 html 网站上输入 {page_title} 时,有没有办法打印网页标题?
问题描述
我正在 Wordpress 上创建一个网站,我必须为每个美国州(例如 domain.com/Alabama)制作 50 页,我想为每个州键入一个更改为“Alabama”的变量等等,所以我想要针对变量打印页面标题。(例如,如果我<h2>Services in {page_title}</h2>
在此页面上键入“domain.com/Alabama”,它应该给我“阿拉巴马州的服务”)
我正在尝试这个get_the_title( int|WP_Post $post )
我得到空白空间...
解决方案
推荐阅读
- c# - 可以在 C# 的 HtmlAgilityPack 中使用 LINQ 吗?
- c# - 随机选择卡片
- c++ - 如何等到池中的所有线程结束工作?
- python - 使用正则表达式提取列的一部分或在 python 中拆分
- python - ValueError:无法解释输入“评级”
- javascript - 使用 Axios 的 HTTP 请求
- python - 获取具有条件的值的总和
- forms - Symfony 4 表单 - 如何在子表单中获取父级的子元素
- twitter - twitter 流 API 是否允许通过 url 过滤?
- node.js - 在 React 应用程序中导入“vscode-languageserver”时出错