{"id":1407,"date":"2019-11-04T21:12:17","date_gmt":"2019-11-04T21:12:17","guid":{"rendered":"https:\/\/haritomedia.ch\/how-to-add-code-snippets-into-a-wordpress-post\/"},"modified":"2020-01-02T21:18:58","modified_gmt":"2020-01-02T21:18:58","slug":"how-to-add-code-snippets-into-a-wordpress-post","status":"publish","type":"post","link":"https:\/\/haritomedia.ch\/en\/how-to-add-code-snippets-into-a-wordpress-post\/","title":{"rendered":"How to Add Code Snippets into a WordPress Post"},"content":{"rendered":"<p>[et_pb_section fb_built=&#8221;1&#8243; _builder_version=&#8221;4.0.9&#8243; custom_padding=&#8221;1px|||||&#8221;][et_pb_row _builder_version=&#8221;4.0.9&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.0.9&#8243;][et_pb_text _builder_version=&#8221;4.0.9&#8243;]<\/p>\n<h1 class=\"title\">How to Add Code Snippets into a WordPress Post<\/h1>\n<p>&nbsp;<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][et_pb_row _builder_version=&#8221;4.0.9&#8243;][et_pb_column type=&#8221;4_4&#8243; _builder_version=&#8221;4.0.9&#8243;][et_pb_text _builder_version=&#8221;4.0.9&#8243;]<\/p>\n<h3>Writing Code in Your WordPress Posts<\/h3>\n<p>An easy way to add code snippets without code getting translated by the browser, and if you need this functionality only ones in a while, is to use this online tool <a title=\"postable\" href=\"http:\/\/www.elliotswan.com\/postable\/\" target=\"_blank\" rel=\"noopener noreferrer\">Postable<\/a>. This tool translates code with the use of <a title=\"Fun Character Entities\" href=\"http:\/\/codex.wordpress.org\/Fun_Character_Entities\">character entities or extended characters<\/a> to represent for example the left and right arrow characters &#8220;&lt;&gt;&#8221; in a way that is not recognized as the beginning and end of an HTML tag by a web browser:<\/p>\n<pre><span style=\"color: #000000; background-color: #ffffcc;\">    &lt; = &amp;lt; or &amp;#60;<\/span><\/pre>\n<pre><span style=\"color: #000000; background-color: #ffffcc;\">    &gt; = &amp;gt; or &amp;#62;<\/span><\/pre>\n<pre><span style=\"color: #000000; background-color: #ffffcc;\">    \/ = &amp;#47;<\/span><\/pre>\n<p>Postable does all this text transformation for you, so you can post a code snipped into a post and preserve it as a code snipped.<\/p>\n<p>Post the &#8220;friendly&#8221; text into your blog post and in HTML view make sure the pre tag is enclosing the whole block of code:\u00a0 <span style=\"font-family: andale mono,times; background-color: #ffffcc;\">&lt;pre&gt;<\/span>text<span style=\"font-family: andale mono,times; background-color: #ffffcc;\">&lt;\/pre&gt;<\/span>Style the <span style=\"font-family: andale mono,times; background-color: #ffffcc;\">pre<\/span> tag in your style sheet.<\/p>\n<p>[\/et_pb_text][\/et_pb_column][\/et_pb_row][\/et_pb_section]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>How to Add Code Snippets into a WordPress Post &nbsp;Writing Code in Your WordPress Posts An easy way to add code snippets without code getting translated by the browser, and if you need this functionality only ones in a while, is to use this online tool Postable. This tool translates code with the use of [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_et_pb_use_builder":"on","_et_pb_old_content":"","_et_gb_content_width":"","footnotes":""},"categories":[20,24],"tags":[],"class_list":["post-1407","post","type-post","status-publish","format-standard","hentry","category-design-en","category-internet-en"],"_links":{"self":[{"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/posts\/1407","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/comments?post=1407"}],"version-history":[{"count":1,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/posts\/1407\/revisions"}],"predecessor-version":[{"id":1408,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/posts\/1407\/revisions\/1408"}],"wp:attachment":[{"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/media?parent=1407"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/categories?post=1407"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/haritomedia.ch\/en\/wp-json\/wp\/v2\/tags?post=1407"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}