{"id":4064,"date":"2015-06-17T11:11:00","date_gmt":"2015-06-17T15:11:00","guid":{"rendered":"http:\/\/irreal.org\/blog\/?p=4064"},"modified":"2015-06-17T11:11:07","modified_gmt":"2015-06-17T15:11:07","slug":"adding-custom-css-to-a-wordpress-site","status":"publish","type":"post","link":"https:\/\/irreal.org\/blog\/?p=4064","title":{"rendered":"Adding Custom CSS to a WordPress Site"},"content":{"rendered":"<p> When I first started blogging with WordPress, I needed some custom CSS. Being a WordPress n00b, I simply added it to the theme&#8217;s CSS file that controls what the site looks like. Of course, that bad decision came back to bite me in the butt and I moved to using <a href=\"http:\/\/irreal.org\/blog\/?p=2472\">a child theme to separate my custom CSS from the theme&#8217;s<\/a>. <\/p>\n<p> Timo Geusch over at <a href=\"http:\/\/www.lonecpluspluscoder.com\">The Lone C++ Coder&#8217;s Blog<\/a> has another way of <a href=\"http:\/\/www.lonecpluspluscoder.com\/2015\/06\/improved-syntax-highlighting-with-org2blog-and-custom-css\/\">adding CSS to your site<\/a>. His method requires the <a href=\"http:\/\/jetpack.me\/\">jetpack<\/a> plugin but is easy to use once you have jetpack installed. Geusch says that he thinks adding a child theme is too heavy duty for what he wanted to do but I didn&#8217;t find it any more complicated that what he did. For example, here is my entire child theme <\/p>\n<div class=\"org-src-container\">\n<pre class=\"src src-css\"><span style=\"color: #b22222;\">\/*<\/span>\n<span style=\"color: #b22222;\"> Theme Name:   Twenty Ten Child<\/span>\n<span style=\"color: #b22222;\"> Theme URI:    http:\/\/irreal.org\/twentyten-child\/<\/span>\n<span style=\"color: #b22222;\"> Description:  Twentyten Child Theme<\/span>\n<span style=\"color: #b22222;\"> Author:       jcs<\/span>\n<span style=\"color: #b22222;\"> Author URI:   http:\/\/irreal.org<\/span>\n<span style=\"color: #b22222;\"> Template:     twentyten<\/span>\n<span style=\"color: #b22222;\"> Version:      1.0.0<\/span>\n<span style=\"color: #b22222;\"> Tags:         light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready<\/span>\n<span style=\"color: #b22222;\"> Text Domain:  twentyten-child<\/span>\n<span style=\"color: #b22222;\">*\/<\/span>\n\n<span style=\"color: #483d8b;\">@import<\/span><span style=\"color: #0000ff;\"> url(<\/span><span style=\"color: #8b2252;\">\"..\/twentyten\/style.css\"<\/span><span style=\"color: #0000ff;\">);<\/span>\n\n<span style=\"color: #b22222;\">\/* <\/span><span style=\"color: #b22222;\">=Theme customization starts here<\/span>\n<span style=\"color: #b22222;\">-------------------------------------------------------------- <\/span><span style=\"color: #b22222;\">*\/<\/span>\n<span style=\"color: #0000ff;\">pre <\/span>{\n        <span style=\"color: #a0522d;\">font-family<\/span>: <span style=\"color: #8b2252;\">\"Courier 10 Pitch\"<\/span>, Courier, monospace;\n        <span style=\"color: #a0522d;\">border<\/span>: 1pt solid black;\n        <span style=\"color: #a0522d;\">padding<\/span>: 3pt;\n        <span style=\"color: #a0522d;\">background-color<\/span>: #F0F8FF;\n        <span style=\"color: #a0522d;\">overflow<\/span>: auto;\n}\n<span style=\"color: #0000ff;\">.key, kbd <\/span>{\n        <span style=\"color: #a0522d;\">border<\/span>:solid 1px #989898;\n        <span style=\"color: #a0522d;\">border-radius<\/span>: 3px;\n        <span style=\"color: #a0522d;\">background-color<\/span>: #F4F4F4;\n        <span style=\"color: #a0522d;\">padding-left<\/span>: .25ex;\n        <span style=\"color: #a0522d;\">padding-right<\/span>: .25ex;\n        <span style=\"color: #a0522d;\">font-family<\/span>: monospace;\n}\n.footpara:nth-child(2) { <span style=\"color: #a0522d;\">display<\/span>: inline; }\n<span style=\"color: #0000ff;\">.footpara <\/span>{ <span style=\"color: #a0522d;\">display<\/span>: block; }\n<span style=\"color: #0000ff;\">.footdef  <\/span>{ <span style=\"color: #a0522d;\">margin-bottom<\/span>: 1em; }\n<span style=\"color: #0000ff;\">#site-title <\/span>{\n        <span style=\"color: #a0522d;\">float<\/span>: left;\n        <span style=\"color: #a0522d;\">font-size<\/span>: 60px;\n        <span style=\"color: #a0522d;\">line-height<\/span>: 36px;\n        <span style=\"color: #a0522d;\">margin<\/span>: 0 0 18px 0;\n        <span style=\"color: #a0522d;\">width<\/span>: 700px;\n}\n<\/pre>\n<\/div>\n<p> Other than the header, it&#8217;s just my custom CSS. Exactly like Geusch&#8217;s solution. <\/p>\n<p> Whatever method you like best, be sure to use one of them if you want to add some custom CSS. Believe me, you don&#8217;t want the pain that messing with the theme&#8217;s CSS will bring you. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>When I first started blogging with WordPress, I needed some custom CSS. Being a WordPress n00b, I simply added it to the theme&#8217;s CSS file that controls what the site looks like. Of course, that bad decision came back to &hellip; <a href=\"https:\/\/irreal.org\/blog\/?p=4064\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[5],"tags":[18,4,119],"class_list":["post-4064","post","type-post","status-publish","format-standard","hentry","category-general","tag-emacs","tag-org-mode","tag-wordpress"],"_links":{"self":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4064","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4064"}],"version-history":[{"count":1,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4064\/revisions"}],"predecessor-version":[{"id":4065,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=\/wp\/v2\/posts\/4064\/revisions\/4065"}],"wp:attachment":[{"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4064"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4064"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/irreal.org\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4064"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}