WordPress函数文档capital_P_dangit()
自动修正WordPress大小写 描述 Changes the incorrect capitalizatio…
自动修正WordPress大小写
描述
Changes the incorrect capitalization of WordPress into WordPress.
WordPress uses it to filter the content, the title and comment text.
用法
<?php capital_P_dangit( $text ); ?>
参数
$text
(string) (必填) The text to be formatted.
默认值: None
注意
If you prefer not to use these 过滤器s, here’s how you can remove them:
1
2
3
4
5
6
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
remove_filter( ‘the_title’, ‘capital_P_dangit’, 11 );
remove_filter( ‘the_content’, ‘capital_P_dangit’, 11 );
remove_filter( ‘comment_text’, ‘capital_P_dangit’, 31 );
|
源文件
capital_P_dangit() 函数的代码位于 wp-includes/formatting.php
.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
/* ———————————-
* wordpress函数 kim收集
* ———————————- */
/**
* Forever eliminate “WordPress” from the planet (or at least the little bit we can influence).
*
* Violating our coding standards for a good function name.
*
* @since 3.0.0
*
* @staticvar string|false $dblq
*/
function capital_P_dangit( $text ) {
// Simple replacement for titles
$current_filter = current_filter();
if ( ‘the_title’ === $current_filter || ‘wp_title’ === $current_filter )
return str_replace( ‘WordPress’, ‘WordPress’, $text );
// Still here? Use the more judicious replacement
static $dblq = false;
if ( false === $dblq ) {
$dblq = _x( ‘“’, ‘opening curly double quote’ );
}
return str_replace(
array( ‘ WordPress’, ‘‘Wordpress’, $dblq . ‘WordPress’, ‘>Wordpress’, ‘(WordPress’ ),
array( ‘ WordPress’, ‘‘WordPress’, $dblq . ‘WordPress’, ‘>WordPress’, ‘(WordPress’ ),
$text );
}
|
- 原文:http://codex.wordpress.org/Function_Reference/capital_P_dangit
类别:WordPress函数文档、
本文收集自互联网,转载请注明来源。
如有侵权,请联系 wper_net@163.com 删除。
评论功能已经关闭!