{"id":2062,"date":"2020-03-28T23:47:28","date_gmt":"2020-03-29T03:47:28","guid":{"rendered":"http:\/\/newmediaproduction.mynmi.net\/?page_id=2062"},"modified":"2020-03-28T23:47:28","modified_gmt":"2020-03-29T03:47:28","slug":"customizing-wordpress-css","status":"publish","type":"page","link":"https:\/\/nmi.cool\/webdev\/customizing-wordpress-css\/","title":{"rendered":"Customizing WordPress CSS"},"content":{"rendered":"\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"2560\" height=\"1920\" src=\"https:\/\/nmi.cool\/newmediaproduction\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1.jpg\" alt=\"Waterfall in forest\" class=\"wp-image-2064\" srcset=\"https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1.jpg 2560w, https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1-300x225.jpg 300w, https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1-1024x768.jpg 1024w, https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1-768x576.jpg 768w, https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1-1536x1152.jpg 1536w, https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/03\/simon-matzinger-9Ct73yKbpEo-unsplash-scaled-1-2048x1536.jpg 2048w\" sizes=\"auto, (max-width: 2560px) 100vw, 2560px\" \/><figcaption>Photo by <a href=\"https:\/\/unsplash.com\/photos\/9Ct73yKbpEo\">Simon Matzinger<\/a><\/figcaption><\/figure>\n\n\n\n<p>Customizing CSS in WordPress can seem a bit intimidating or confounding, but once you get the hang of it, it&#8217;s actually relatively simple and incredibly powerful.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"where-to-customize-css-in-wordpress\">Where to customize CSS in WordPress<\/h2>\n\n\n\n<p><code>Reading: <a href=\"https:\/\/themeisle.com\/blog\/css-in-wordpress\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">Beginner\u2019s Guide: How to Use CSS in WordPress for Easy Style Tweaks<\/a> by John Hughes<\/code><\/p>\n\n\n\n<p>The above reading walks through the basics of the primary way<a href=\"#footnote-1-2062\" id=\"note-1-2062\" rel=\"footnote\">1<\/a> to customize CSS in WordPress.<\/p>\n\n\n\n<p>In short, from the WordPress dashboard, you&#8217;ll visit Appearance &gt; Customize and then choose &#8220;Additional CSS.&#8221; The article contains good screenshots and examples, but I&#8217;ll add here that a great way to think about the &#8220;Additional CSS&#8221; box is like the notion of a <a href=\"https:\/\/nmi.cool\/webdev\/customizing-bootstrap\/\" target=\"_blank\" rel=\"noreferrer noopener\">custom.css in Bootstrap<\/a>. The styles you write here are applied last and therefore override any other styles from your theme. As always, <a href=\"https:\/\/nmi.cool\/webdev\/inspector-gadgets\/\" target=\"_blank\" rel=\"noreferrer noopener\">DevTools \/ the inspector<\/a> are your best friends, so take the time to get to know them well.<\/p>\n\n\n\n<p>This <a href=\"https:\/\/wordpress.com\/support\/custom-design\/editing-css\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">support article for WordPress.com<\/a><a href=\"#footnote-2-2062\" id=\"note-2-2062\" rel=\"footnote\">2<\/a> adds a few good additional details.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"targeting-specific-pages\">Targeting Specific Pages<\/h2>\n\n\n\n<p><code>Reading: <a href=\"https:\/\/www.bellinghamwp.com\/wordpress-css\/wordpress-customize-the-css-for-specific-pages-or-posts\/\" target=\"_blank\" rel=\"noreferrer noopener\" aria-label=\" (opens in a new tab)\">WordPress: Customize the CSS for specific pages or posts<\/a> by Rick D'Haene<\/code><\/p>\n\n\n\n<p>What we&#8217;ve covered so far will help you style <em>all<\/em> your pages, but what if you want to apply styles to just one single page? It&#8217;s not at all obvious at first, but WordPress actually provides a surprisingly simple method for doing so.<\/p>\n\n\n\n<p>As the above reading details, WordPress generates a specific CSS class for each individual page and post. With a little practice and careful thinking, you&#8217;ll be able to customize your WordPress site to your heart&#8217;s content.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"adding-a-google-font-to-your-additional-css\">Adding a Google Font to your Additional CSS <\/h2>\n\n\n\n<p>While there are several plugins that help you add fonts of your website, it&#8217;s surprisingly simple to add a Google Font (or two!) to your WordPress site using just additional CSS. <\/p>\n\n\n\n<p>To get started, navigate to <a rel=\"noreferrer noopener\" href=\"https:\/\/fonts.google.com\/?sidebar.open=true&amp;selection.family=Syne+Mono\" target=\"_blank\">Google Fonts<\/a> and find the font you&#8217;d like to use on your WordPress site. Click &#8220;select this font&#8221; and then &#8220;Embed&#8221; under Selected Family, and then @import. <\/p>\n\n\n\n<figure class=\"wp-block-image aligncenter size-large\"><img decoding=\"async\" src=\"https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/10\/Screen-Shot-2020-10-28-at-12.03.05-PM-1.png\" alt=\"\" class=\"wp-image-2473\" \/><\/figure>\n\n\n\n<p>You don&#8217;t want the <code>&lt;link&gt;<\/code> for your WordPress site: think about that for a minute and see if you can mentally explain why we won&#8217;t use that.<a href=\"#footnote-3-2062\" id=\"note-3-2062\" rel=\"footnote\">3<\/a>. <\/p>\n\n\n\n<p>Next, you are going to copy the <code>@import url<\/code> from between the two <code>&lt;style&gt;<\/code> tags. Again, think for a minute about why we don&#8217;t want those two <code>&lt;style&gt;<\/code> tags in our CSS document.<a href=\"#footnote-4-2062\" id=\"note-4-2062\" rel=\"footnote\">4<\/a> Paste that <code>@import URL<\/code> at the <strong>top<\/strong> of the Additional CSS area of your WordPress site. Then, copy the CSS rule from Google Fonts and apply it to whatever element your are trying to style. See below for an example of how it should look! <\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img decoding=\"async\" src=\"https:\/\/nmi.cool\/webdev\/wp-content\/uploads\/sites\/14\/2020\/10\/Screen-Shot-2020-10-28-at-12.10.55-PM-1.png\" alt=\"\" class=\"wp-image-2474\" \/><\/figure>\n\n\n\n<p> <\/p>\n<div class=\"footnotes\"><hr \/><ol><li id=\"footnote-1-2062\" class=\"footnote\"><p>As with just about everything in WordPress, there are a thousand different ways you <em>could<\/em> do this, but this method should be all most people need.<a href=\"#note-1-2062\" class=\"footnote-return\">&#8617;<\/a><\/p><\/li><!--\/#footnote-1.footnote--><li id=\"footnote-2-2062\" class=\"footnote\"><p>One of the many benefits of learning the stuff we cover in this class is that things you&#8217;re charged for at WordPress.com are free with self-hosted WordPress!<a href=\"#note-2-2062\" class=\"footnote-return\">&#8617;<\/a><\/p><\/li><!--\/#footnote-2.footnote--><li id=\"footnote-3-2062\" class=\"footnote\"><p> The Additional CSS area on WordPress reads CSS, not HTML. The <code>&lt;link&gt;<\/code> is an HTML element, so it won&#8217;t work in our CSS.<a href=\"#note-3-2062\" class=\"footnote-return\">&#8617;<\/a><\/p><\/li><!--\/#footnote-3.footnote--><li id=\"footnote-4-2062\" class=\"footnote\"><p>Yup, that&#8217;s right: <code>&lt;style&gt;<\/code> is an HTML element that we use when creating an internal stylesheet. Since the Additional CSS input area reads CSS and not  HTML we do not want to include them.<a href=\"#note-4-2062\" class=\"footnote-return\">&#8617;<\/a><\/p><\/li><!--\/#footnote-4.footnote--><\/ol><\/div><!--\/#footnotes-->","protected":false},"excerpt":{"rendered":"<p>Customizing CSS in WordPress can seem a bit intimidating or confounding, but once you get the hang of it, it&#8217;s actually relatively simple and incredibly powerful. Where to customize CSS in WordPress Reading: Beginner\u2019s Guide: How to Use CSS in WordPress for Easy Style Tweaks by John Hughes The above reading walks through the basics [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"footnotes":""},"class_list":["post-2062","page","type-page","status-publish","hentry"],"_links":{"self":[{"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/pages\/2062","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/comments?post=2062"}],"version-history":[{"count":0,"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/pages\/2062\/revisions"}],"wp:attachment":[{"href":"https:\/\/nmi.cool\/webdev\/wp-json\/wp\/v2\/media?parent=2062"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}