WordPress短码显示页面标题&排除特定单词形式的标题
我有一个显示页面标题的WordPress快捷代码,但是我现在需要排除特定单词形式的页面标题
,有时我在标题单词中有 best或top ,
例如,如果页面标题是加利福尼亚最佳城市 短码需要显示(加利福尼亚州的 City )
这是我有关如何显示标题
function post_title_shortcode(){
return get_the_title();
}
add_shortcode('page_title','post_title_shortcode');
谢谢的代码
I have a WordPress Shortcode that displays the page title, but I need now to exclude specific words form the Page Title
For example, sometimes I have in the title words like Best or Top
For example, if the page title is Best City in California
shortcode needs to show ( City in California )
This is my code on how to display the title
function post_title_shortcode(){
return get_the_title();
}
add_shortcode('page_title','post_title_shortcode');
Thank You
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
似乎很容易。在功能中,post_title_shortcode做类似的事情:
It seems easy. Inside the function post_title_shortcode do something similar:
在短码处理程序中写入一些代码以调整标题的文本。这种事情可能有效。
Write some code in your shortcode handler to adjust the text of the title. This kind of thing might work.