admin管理员组文章数量:1130349
When I write my site's title, description, posts, pages, or a taxonomy description, small dashes - are turned into longer, uglier ones –.
Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?
When I write my site's title, description, posts, pages, or a taxonomy description, small dashes - are turned into longer, uglier ones –.
Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?
Share Improve this question edited Dec 9, 2012 at 8:27 shea 5,6724 gold badges39 silver badges62 bronze badges asked Dec 9, 2012 at 6:07 webmasterswebmasters 3112 gold badges7 silver badges21 bronze badges 02 Answers
Reset to default 1- is a hyphen or minus, not a dash. Converting it to an en dash is actually the correct thing to do from a typographical standpoint.
http://en.wikipedia/wiki/Hyphen-minus
Typography is one of those deep-read kind of ideas, but the bottom line is that you think the hyphen minus is the correct character to use because of limitations in early typewriters. The correct character to use in most all the instances where you type the minus sign, from a typesetting and printing (and now, web) point of view is actually the en dash.
But if you really want to use incorrect typography, then bungeshea's approach above will work, or you can remove the wptexturize filter from the_content. The wptexturize function corrects this common typographical mistake, as well as fixing quotes, apostrophes, primes and double primes, dashes, whole bunch of other stuff. Basically it transforms what you type into the correct typography for it.
The transformation happens in the wptexturize() function. It turns a regular dash (-) into an en dash (–). The function translates the en dash using the _x() function, which in turn uses the gettext_with_context filter. We can hook into this filter to return a regular dash instead of an en dash:
add_filter( 'gettext_with_context', 'wpse_75445_use_pretty_dash', 10, 2 );
function wpse_75445_use_pretty_dash( $text, $context ) {
if ( $text == '–' && $context == 'en dash' )
$text = '-'
return $text;
}
However, as explained in Otto's answer, it's typographically correct to use an en dash instead of a hyphen/minus sign. But it is your site, so whatever works for you and your users.
When I write my site's title, description, posts, pages, or a taxonomy description, small dashes - are turned into longer, uglier ones –.
Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?
When I write my site's title, description, posts, pages, or a taxonomy description, small dashes - are turned into longer, uglier ones –.
Is there some way to stop this from happening? Can I put some sort of function in my functions.php? Any ideas?
Share Improve this question edited Dec 9, 2012 at 8:27 shea 5,6724 gold badges39 silver badges62 bronze badges asked Dec 9, 2012 at 6:07 webmasterswebmasters 3112 gold badges7 silver badges21 bronze badges 02 Answers
Reset to default 1- is a hyphen or minus, not a dash. Converting it to an en dash is actually the correct thing to do from a typographical standpoint.
http://en.wikipedia/wiki/Hyphen-minus
Typography is one of those deep-read kind of ideas, but the bottom line is that you think the hyphen minus is the correct character to use because of limitations in early typewriters. The correct character to use in most all the instances where you type the minus sign, from a typesetting and printing (and now, web) point of view is actually the en dash.
But if you really want to use incorrect typography, then bungeshea's approach above will work, or you can remove the wptexturize filter from the_content. The wptexturize function corrects this common typographical mistake, as well as fixing quotes, apostrophes, primes and double primes, dashes, whole bunch of other stuff. Basically it transforms what you type into the correct typography for it.
The transformation happens in the wptexturize() function. It turns a regular dash (-) into an en dash (–). The function translates the en dash using the _x() function, which in turn uses the gettext_with_context filter. We can hook into this filter to return a regular dash instead of an en dash:
add_filter( 'gettext_with_context', 'wpse_75445_use_pretty_dash', 10, 2 );
function wpse_75445_use_pretty_dash( $text, $context ) {
if ( $text == '–' && $context == 'en dash' )
$text = '-'
return $text;
}
However, as explained in Otto's answer, it's typographically correct to use an en dash instead of a hyphen/minus sign. But it is your site, so whatever works for you and your users.
本文标签: functionsStop turning small dashes into longer ones
版权声明:本文标题:functions - Stop turning small dashes into longer ones 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749241349a2338145.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论