css - 将动态元标题中的一个词大写

标签 css wordpress title meta capitalize

有没有办法在动态元标题中将一个单词大写?

基本上我在元标题中使用了一个 slug,但它是小写的。我只想将那个词大写,但我不确定这样做的最佳方式?

<title><?php $taxonomy = 'propertytype'; $queried_term = get_query_var($taxonomy);$term = get_term_by( 'slug', $queried_term, $taxonomy ); echo $term->slug; ?> the rest of the thitle goes here</title>

有没有办法把标题中的 slug 大写?

非常感谢

保罗

最佳答案

<?php
$taxonomy = 'propertytype';
$queried_term = get_query_var($taxonomy);
$term = get_term_by( 'slug', $queried_term, $taxonomy );
$cap = ucwords($term->slug);
?>
<title><?=$cap?>the rest of the thitle goes here</title>

关于css - 将动态元标题中的一个词大写,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10384045/

相关文章:

java - android中的文本框错误

python - 在 Python pylab rose/polar plot 中更改图例标题的字体大小

html - 图片 Alt 和标题不显示,因为 Z-index

css - Angular - 在路由更改时为外部元素设置动画

html - 如何通过绝对div调整div的大小

javascript - 使用 Jquery 的可链接选项卡

php - Uncaught Error : Call to a member function get() on null | $chosen_shipping_rates

CSS after before 属性不起作用?

jquery - 填充一个div而不溢出它

mysql - 服务器配置问题 : Wordpress won't display posts after migration