{"id":5601,"date":"2016-03-16T12:30:09","date_gmt":"2016-03-16T12:30:09","guid":{"rendered":"https:\/\/bodhost.com\/kb\/?p=5601"},"modified":"2026-02-26T14:03:12","modified_gmt":"2026-02-26T14:03:12","slug":"displaying-code-wordpress-site","status":"publish","type":"post","link":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/","title":{"rendered":"The Simple Solution to Displaying Code on a WordPress Site"},"content":{"rendered":"\r\n<p class=\"wp-block-paragraph\">For the uninitiated the task of displaying code on a WordPress site can seem more than a little daunting; we will simplify the process and guide you to a successful conclusion.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Firstly WordPress are quite strict, they will block attempts to post raw code, whether it be attached to comments or widgets. This from a security point of view is quite reasonable. However, the facility to share \u2018snippets\u2019 on your blog is an absolute must.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">So straight to the point, in order to display time-saving \u2018snippets\u2019 of code then first install the Syntax Highlighter Evolved plugin. Once you have activated the plugin it needs to be configured; do this by going to \u2018settings\u2019 then \u2018Syntax Highlighter\u2019. It should be relatively straightforward.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">OK, hopefully, you are now into the Syntax Highlighter settings. Here you\u2019ll have the option to adapt settings to your requirements. Check out the options and when you\u2019re happy \u2018save changes\u2019. In truth, the basic plugin settings generally do the job.<\/p>\r\n\r\n\r\n\r\n<h3 class=\"wp-block-heading\"><strong>For PHP you would wrap your code like this:<\/strong><\/h3>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">\u00a0<\/pre>\r\n\r\n\r\n<p>[php]<\/p>\n<p><!--?php echo \u201cHello World\u201d; ?--><\/p>\n<p>[\/php]<\/p>\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">It will appear in your post like this: 1 For CSS you will wrap your code like this:<\/p>\r\n\r\n\r\n<p>[css] .entry-title { font-family:\u201dOpen Sans\u201d, arial, sans-serif; font-size:16px; color:#272727; } [\/css]<\/p>\n\r\n\r\n\r\n<h4 class=\"wp-block-heading\"><strong>It will appear on your site like this:<\/strong><\/h4>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">1.entry-title <br \/>{\r\n2. font-family:\"Open Sans\", arial, sans-serif;\r\n3. font-size:16px;\r\n4 color:#272727;\r\n}\r\n<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">The code for your chosen language will be automatically highlighted with the inclusion of the line numbers and handle tab indent. It\u2019s all very clever, recipients can then simply copy and paste \u2018snippet\u2019 codes.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Please note: You don\u2019t always require a plugin for WordPress, because code can be displayed without a plugin. Read on\u2026<\/p>\r\n\r\n\r\n\r\n<h5 class=\"wp-block-heading\"><strong>Code can be encoded into HTML entities. Here\u2019s an example:<\/strong><\/h5>\r\n\r\n\r\n\r\n<pre class=\"wp-block-preformatted\">&gt;?php echo \"Hello World\"; ?&lt;<\/pre>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">You can go online and find an appropriate tool but this, I\u2019m afraid, becomes a rather laborious task. OK perhaps for low-volume users, but not recommended long term.<\/p>\r\n\r\n\r\n\r\n<p class=\"wp-block-paragraph\">Once you have converted HTML, PHP, and JavaScript code into HTML format, you can then simply paste them into any WordPress post. Wrapping code between <code> and <\/code> will allow for additional styling.<\/p>\r\n","protected":false},"excerpt":{"rendered":"<p>For the uninitiated the task of displaying code on a WordPress site can seem more than a little daunting; we will simplify the process and guide you to a successful&hellip;<\/p>\n<p><a href=\"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/\" class=\"more-link\">Read More<\/a><\/p>\n","protected":false},"author":17,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[664],"tags":[719,720,721],"class_list":["post-5601","post","type-post","status-publish","format-standard","hentry","category-web-hosting","tag-display-code-in-wordpress-post","tag-show-code-in-wordpress-post","tag-wordpress-code-snippet-in-post"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>The Simple Solution to Displaying Code on a WordPress Site<\/title>\n<meta name=\"description\" content=\"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.\" \/>\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.bodhost.com\/kb\/displaying-code-wordpress-site\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"The Simple Solution to Displaying Code on a WordPress Site\" \/>\n<meta property=\"og:description\" content=\"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/\" \/>\n<meta property=\"og:site_name\" content=\"Knowledge Base - bodHOST\" \/>\n<meta property=\"article:published_time\" content=\"2016-03-16T12:30:09+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2026-02-26T14:03:12+00:00\" \/>\n<meta name=\"author\" content=\"Monitoring\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Monitoring\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/\"},\"author\":{\"name\":\"Monitoring\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/5b35e4e897280691437d3efc95aed75b\"},\"headline\":\"The Simple Solution to Displaying Code on a WordPress Site\",\"datePublished\":\"2016-03-16T12:30:09+00:00\",\"dateModified\":\"2026-02-26T14:03:12+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/\"},\"wordCount\":347,\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"keywords\":[\"display code in wordpress post\",\"show code in wordpress post\",\"wordpress code snippet in post\"],\"articleSection\":[\"Web Hosting\"],\"inLanguage\":\"en-US\"},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/\",\"name\":\"The Simple Solution to Displaying Code on a WordPress Site\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\"},\"datePublished\":\"2016-03-16T12:30:09+00:00\",\"dateModified\":\"2026-02-26T14:03:12+00:00\",\"description\":\"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/displaying-code-wordpress-site\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Web Hosting\",\"item\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/category\\\/web-hosting\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"The Simple Solution to Displaying Code on a WordPress Site\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#website\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\"},\"alternateName\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#organization\",\"name\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"contentUrl\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/wp-content\\\/uploads\\\/2025\\\/10\\\/Profile-Pic.png\",\"width\":240,\"height\":240,\"caption\":\"Web Hosting Knowledge Base | bodHOST Hosting FAQ\"},\"image\":{\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/#\\\/schema\\\/person\\\/5b35e4e897280691437d3efc95aed75b\",\"name\":\"Monitoring\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g\",\"caption\":\"Monitoring\"},\"url\":\"https:\\\/\\\/www.bodhost.com\\\/kb\\\/author\\\/monitoring\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"The Simple Solution to Displaying Code on a WordPress Site","description":"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.","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.bodhost.com\/kb\/displaying-code-wordpress-site\/","og_locale":"en_US","og_type":"article","og_title":"The Simple Solution to Displaying Code on a WordPress Site","og_description":"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.","og_url":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/","og_site_name":"Knowledge Base - bodHOST","article_published_time":"2016-03-16T12:30:09+00:00","article_modified_time":"2026-02-26T14:03:12+00:00","author":"Monitoring","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Monitoring","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/#article","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/"},"author":{"name":"Monitoring","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/5b35e4e897280691437d3efc95aed75b"},"headline":"The Simple Solution to Displaying Code on a WordPress Site","datePublished":"2016-03-16T12:30:09+00:00","dateModified":"2026-02-26T14:03:12+00:00","mainEntityOfPage":{"@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/"},"wordCount":347,"publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"keywords":["display code in wordpress post","show code in wordpress post","wordpress code snippet in post"],"articleSection":["Web Hosting"],"inLanguage":"en-US"},{"@type":"WebPage","@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/","url":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/","name":"The Simple Solution to Displaying Code on a WordPress Site","isPartOf":{"@id":"https:\/\/www.bodhost.com\/kb\/#website"},"datePublished":"2016-03-16T12:30:09+00:00","dateModified":"2026-02-26T14:03:12+00:00","description":"Struggling to display code on your WordPress site? Use a code formatting plugin like SyntaxHighlighter or WP Code Highlight. Read on for more tips.","breadcrumb":{"@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.bodhost.com\/kb\/displaying-code-wordpress-site\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Web Hosting","item":"https:\/\/www.bodhost.com\/kb\/category\/web-hosting\/"},{"@type":"ListItem","position":2,"name":"The Simple Solution to Displaying Code on a WordPress Site"}]},{"@type":"WebSite","@id":"https:\/\/www.bodhost.com\/kb\/#website","url":"https:\/\/www.bodhost.com\/kb\/","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","description":"","publisher":{"@id":"https:\/\/www.bodhost.com\/kb\/#organization"},"alternateName":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.bodhost.com\/kb\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.bodhost.com\/kb\/#organization","name":"Web Hosting Knowledge Base | bodHOST Hosting FAQ","url":"https:\/\/www.bodhost.com\/kb\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/","url":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","contentUrl":"https:\/\/www.bodhost.com\/kb\/wp-content\/uploads\/2025\/10\/Profile-Pic.png","width":240,"height":240,"caption":"Web Hosting Knowledge Base | bodHOST Hosting FAQ"},"image":{"@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.bodhost.com\/kb\/#\/schema\/person\/5b35e4e897280691437d3efc95aed75b","name":"Monitoring","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/52f304a7cceef71dabfcf8c0ea93164a7e144e61ba4a59f7cfdcc60bf8191593?s=96&d=mm&r=g","caption":"Monitoring"},"url":"https:\/\/www.bodhost.com\/kb\/author\/monitoring\/"}]}},"_links":{"self":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5601","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/users\/17"}],"replies":[{"embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/comments?post=5601"}],"version-history":[{"count":13,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5601\/revisions"}],"predecessor-version":[{"id":12089,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/posts\/5601\/revisions\/12089"}],"wp:attachment":[{"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/media?parent=5601"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/categories?post=5601"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.bodhost.com\/kb\/wp-json\/wp\/v2\/tags?post=5601"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}