{"id":4389,"date":"2018-10-24T02:32:58","date_gmt":"2018-10-23T17:32:58","guid":{"rendered":"http:\/\/www.catracing.org\/hendrb\/?p=4389"},"modified":"2018-10-24T03:37:51","modified_gmt":"2018-10-23T18:37:51","slug":"wednesday-quickie-dash-vs-em-dash","status":"publish","type":"post","link":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/","title":{"rendered":"Wednesday Quickie &#8211; Dash vs Em Dash"},"content":{"rendered":"<h1 style=\"text-align: center;\"><span style=\"color: #0000ff;\">Wednesday Quickie \u2013 Modifying WordPress Translation Filters<\/span><\/h1>\n<hr>\n<p>&nbsp; When I publish a \u2018quickie\u2019 I usually try and tie it into the main blog that was published that week.&nbsp; This month\u2019s quickie however will tie into the blog as a whole.&nbsp; This may be small potatoes to 97.3% of my readers, however to me this is \u2018YUGE\u2019!&nbsp; It has bothered me for as long as I have used WordPress that double dashes &#8212; are translated in to a \u2013 em dash.&nbsp; While this may be typographically correct, try it on your Wordprocessor, dollars to doughnuts it will convert it to an em dash as well.&nbsp; There are times when it is just plain wrong, take for instance my *nix tutorials.&nbsp; $somecommand &#8211;somefunction is not the same as $somecommand \u2014somefunction.&nbsp; I always felt bad that if you followed my yellow text it would not work (unless you noticed the difference in the screenshot), cause utter confusion, and might even make you think I don\u2019t know what I am doing and not return to the blog.&nbsp; So, I finally decided to DO SOMETHING ABOUT IT!&nbsp;Sitting down in front of Google I was bound and determined to figure this out, what makes WP do this, and most importantly how do I stop it?!&nbsp; This led me to the \/wp-includes\/formatting.php file.<\/p>\n<p>&nbsp; Taken from the codex on<br \/>\n<span style=\"color: #00ffff;\"><a style=\"color: #00ffff;\" href=\"http:\/\/www.wordpress.com\/\">www.wordpress.com ,<\/a><a style=\"color: #00ffff;\" href=\"https:\/\/codex.wordpress.org\/Function_Reference\/wptexturize\">https:\/\/codex.wordpress.org\/Function_Reference\/wptexturize<\/a>.<\/span> Formatting.php does the following, \u201cThis returns given text with transformations of quotes to smart quotes, apostrophes, dashes, ellipses, the trademark symbol, and the multiplication symbol.\u201d<\/p>\n<p>&nbsp; So the lightbult went on that maybe, just maybe I could find the function that performed the conversion.&nbsp;Which I was able to do.<\/p>\n<p>Here is the block we are looking for.<\/p>\n<p>&nbsp;\/\/ Dashes and spaces<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dynamic[ &#8216;\/&#8212;\/&#8217; ] = $em_dash;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dynamic[ &#8216;\/(?&lt;=^|&#8217; . $spaces . &#8216;)&#8211;(?=$|&#8217; . $spaces . &#8216;)\/&#8217; ] = $em_dash;<br \/>\n#&nbsp; &nbsp; &nbsp; &nbsp;$dynamic[ &#8216;\/(?&lt;!xn)&#8211;\/&#8217; ] = $en_dash; (Pounded out &#8211;&nbsp;23OCT2018 to prevent WP from translating double dashes into em_dash)&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dynamic[ &#8216;\/(?&lt;=^|&#8217; . $spaces . &#8216;)-(?=$|&#8217; . $spaces . &#8216;)\/&#8217; ] = $en_dash;<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dynamic_characters[&#8216;dash&#8217;] = array_keys( $dynamic );<br \/>\n&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$dynamic_replacements[&#8216;dash&#8217;] = array_values( $dynamic );<\/p>\n<p>&nbsp; You can see from the above where the double hyphens are translated into the em_dash.&nbsp; I simply commented the line out, and also added the commend above it (That I will move later!) that can be used if I ever need to go back into the file and remove or change what I added, as I will most likely forget.<\/p>\n<p>&nbsp; I then restarted httpd $sudo systemctl restart httpd command to reload php, and tested and as you can see below.&nbsp; IT WORKED!<\/p>\n<p>&nbsp; So, what if I actually want to use an em dash in one of my posts?<\/p>\n<p>&nbsp; I can still do this by using the actual key combinations.<\/p>\n<p>On OS macOS use Shift-Option \u2013 (minus)<br \/>\nOn Windows use Alt-Ctl \u2013 (minus)<\/p>\n<p>&nbsp; The only issue I have with this modification is that the formatting.php file will most likely be re-written in a major WP upgrade, so every time I upgrade to a newer version I will need to put my mod back in.&nbsp;<\/p>\n<p>&nbsp; Thank you for reading this Brent\u2019s World Wednesday Quickie!&nbsp; We hope you will return for more great content.&nbsp; If you wish to be notified when new content is published, you may register by clicking <a href=\"http:\/\/www.catracing.org\/hendrb\/wp-login.php\"><span style=\"color: #00ffff;\">HERE<\/span><\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Wednesday Quickie \u2013 Modifying WordPress Translation Filters &nbsp; When I publish a \u2018quickie\u2019 I usually try and tie it into the main blog that was published that week.&nbsp; This month\u2019s quickie however will tie into the blog as a whole.&nbsp; <span class=\"excerpt-dots\">&hellip;<\/span> <a class=\"more-link\" href=\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\"><span class=\"more-msg\">Continue reading &rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[3],"tags":[],"class_list":["post-4389","post","type-post","status-publish","format-standard","hentry","category-technical"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.2 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World\" \/>\n<meta property=\"og:description\" content=\"Wednesday Quickie \u2013 Modifying WordPress Translation Filters &nbsp; When I publish a \u2018quickie\u2019 I usually try and tie it into the main blog that was published that week.&nbsp; This month\u2019s quickie however will tie into the blog as a whole.&nbsp; &hellip; Continue reading &rarr;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\" \/>\n<meta property=\"og:site_name\" content=\"Brent&#039;s World\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/Brents-World-912767498915017\" \/>\n<meta property=\"article:author\" content=\"https:\/\/www.facebook.com\/Brents-World-912767498915017\" \/>\n<meta property=\"article:published_time\" content=\"2018-10-23T17:32:58+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2018-10-23T18:37:51+00:00\" \/>\n<meta name=\"author\" content=\"Brent Hendricks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Brent Hendricks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\"},\"author\":{\"name\":\"Brent Hendricks\",\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442\"},\"headline\":\"Wednesday Quickie &#8211; Dash vs Em Dash\",\"datePublished\":\"2018-10-23T17:32:58+00:00\",\"dateModified\":\"2018-10-23T18:37:51+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\"},\"wordCount\":626,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442\"},\"articleSection\":[\"Technical\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\",\"url\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\",\"name\":\"Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World\",\"isPartOf\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#website\"},\"datePublished\":\"2018-10-23T17:32:58+00:00\",\"dateModified\":\"2018-10-23T18:37:51+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.catracing.org\/hendrb\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Wednesday Quickie &#8211; Dash vs Em Dash\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#website\",\"url\":\"https:\/\/www.catracing.org\/hendrb\/\",\"name\":\"Brent&#039;s World\",\"description\":\"Your weekly dose of the life of Brent!\",\"publisher\":{\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.catracing.org\/hendrb\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442\",\"name\":\"Brent Hendricks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg\",\"url\":\"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg\",\"contentUrl\":\"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg\",\"width\":4480,\"height\":6720,\"caption\":\"Brent Hendricks\"},\"logo\":{\"@id\":\"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg\"},\"sameAs\":[\"http:\/\/www.catracing.org\",\"https:\/\/www.facebook.com\/Brents-World-912767498915017\"],\"url\":\"https:\/\/www.catracing.org\/hendrb\/author\/hendrb01\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/","og_locale":"en_US","og_type":"article","og_title":"Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World","og_description":"Wednesday Quickie \u2013 Modifying WordPress Translation Filters &nbsp; When I publish a \u2018quickie\u2019 I usually try and tie it into the main blog that was published that week.&nbsp; This month\u2019s quickie however will tie into the blog as a whole.&nbsp; &hellip; Continue reading &rarr;","og_url":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/","og_site_name":"Brent&#039;s World","article_publisher":"https:\/\/www.facebook.com\/Brents-World-912767498915017","article_author":"https:\/\/www.facebook.com\/Brents-World-912767498915017","article_published_time":"2018-10-23T17:32:58+00:00","article_modified_time":"2018-10-23T18:37:51+00:00","author":"Brent Hendricks","twitter_misc":{"Written by":"Brent Hendricks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#article","isPartOf":{"@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/"},"author":{"name":"Brent Hendricks","@id":"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442"},"headline":"Wednesday Quickie &#8211; Dash vs Em Dash","datePublished":"2018-10-23T17:32:58+00:00","dateModified":"2018-10-23T18:37:51+00:00","mainEntityOfPage":{"@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/"},"wordCount":626,"commentCount":1,"publisher":{"@id":"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442"},"articleSection":["Technical"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/","url":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/","name":"Wednesday Quickie - Dash vs Em Dash - Brent&#039;s World","isPartOf":{"@id":"https:\/\/www.catracing.org\/hendrb\/#website"},"datePublished":"2018-10-23T17:32:58+00:00","dateModified":"2018-10-23T18:37:51+00:00","breadcrumb":{"@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.catracing.org\/hendrb\/wednesday-quickie-dash-vs-em-dash\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.catracing.org\/hendrb\/"},{"@type":"ListItem","position":2,"name":"Wednesday Quickie &#8211; Dash vs Em Dash"}]},{"@type":"WebSite","@id":"https:\/\/www.catracing.org\/hendrb\/#website","url":"https:\/\/www.catracing.org\/hendrb\/","name":"Brent&#039;s World","description":"Your weekly dose of the life of Brent!","publisher":{"@id":"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.catracing.org\/hendrb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/www.catracing.org\/hendrb\/#\/schema\/person\/abd5b294207e782562c7bb51e0a9e442","name":"Brent Hendricks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg","url":"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg","contentUrl":"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg","width":4480,"height":6720,"caption":"Brent Hendricks"},"logo":{"@id":"http:\/\/www.catracing.org\/hendrb\/wp-content\/uploads\/2019\/05\/Brent-Sitting-portrait-2.jpg"},"sameAs":["http:\/\/www.catracing.org","https:\/\/www.facebook.com\/Brents-World-912767498915017"],"url":"https:\/\/www.catracing.org\/hendrb\/author\/hendrb01\/"}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p43ojH-18N","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/posts\/4389","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/comments?post=4389"}],"version-history":[{"count":0,"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/posts\/4389\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/media?parent=4389"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/categories?post=4389"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.catracing.org\/hendrb\/wp-json\/wp\/v2\/tags?post=4389"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}