WordPress 常用函数 / wptexturize
简介
将纯文本字符转换成格式化的 HTML 实体。
<PRE>,<CODE>,<kbd>,<STYLE>,<script>和<tt>中的文本被忽略。
用法
<?php wptexturize( $text ); ?>参数
$text
(string) (required) 将被格式化的文本
Default: None
返回值
(string)
被替换成HTML数字实体字符的文本。
注解
开启和关闭引号将在 WordPress 翻译文件中被定义,下面是 wptexturize 做的转换。
| 原始文本 | 转换之后的文本 | 符号名称 | 
|---|---|---|
| "---" | "—" | em-dash | 破折号 | 
| " -- " | "—" | em-dash | 破折号 | 
| "--" | "–" | en-dash | 连接号 | 
| " - " | "–" | en-dash | 连接号 | 
| "..." | "…" | ellipsis | 省略号 | 
| "xn–" | "xn--" | |
| `` | “ | opening quote | 开启引号 | 
| "hello | “hello | opening quote | 开启引号 | 
| 'hello | ‘hello | opening quote | 开启引号 | 
| '' | ” | closing quote | 关闭引号 | 
| world." | world.” | closing quote | 关闭引号 | 
| world.' | world.’ | closing quote | 关闭引号 | 
| " (tm) " | " ™ " | trademark symbol | 注册商标符号 | 
| 1234" | 1234″ | double prime symbol | 角秒符号 | 
| 1234' | 1234′ | prime symbol | 角分符号 | 
| '99 | ’99 | apostrophe|缩写年份前的撇号 | 
| Webster's | Webster’s | apostrophe|单词中的撇号 | 
| 1234x1234 | 1234×1234 | multiplication symbol | 乘法符号 | 
修改记录
Since: 0.71
源文件
wp-includes/formatting.php
 
				
			







