{"id":6059,"date":"2011-10-09T10:08:42","date_gmt":"2011-10-09T15:08:42","guid":{"rendered":"http:\/\/www.allyngibson.net\/?p=6059"},"modified":"2013-08-28T01:08:11","modified_gmt":"2013-08-28T01:08:11","slug":"on-writing-more-wordpress-code","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=6059","title":{"rendered":"On Writing More WordPress Code"},"content":{"rendered":"<p>Two months ago, I wrote how I was <a href=\"http:\/\/www.allyngibson.com\/?p=5955\">planning a blog redesign<\/a>.<\/p>\n<p>It&#8217;s not something I&#8217;ve worked on with any great alacrity; I don&#8217;t need it for another eight months.  Basically, a nearly decade-old blog has outgrown its host, and I need to move it to another host, but my current hosting plan isn&#8217;t up until the middle of June.  So, here and there, I&#8217;ll work on a little code, and last night I spent three hours working on the front page.  What I have in mind is a magazine-style theme, and while my current site is <i>sort of<\/i> that, I want to take it a little further and better integrate the elements.<\/p>\n<p>There are some things I&#8217;ve never used in a WordPress theme that I&#8217;m experimenting with.<\/p>\n<p>Javascript.  I built a featured posts carousel using Javascript.  It required two custom loops to pass information to the JS routine properly, and to my ever-loving shock it worked correctly the first time.<\/p>\n<p>Post Thumbnails.  My present theme uses post thumbnails, but it doesn&#8217;t use the built-in WordPress functions to generate or display them.  The current theme does.  I&#8217;ve defined what the default size should be, and then I&#8217;ve also defined three other sizes, based on what role a post has on the front page.  Plus, one of those sizes is used to put an image on the single post page automatically.  Things I would hard-code into a post I don&#8217;t have to hard-code anymore.<\/p>\n<p>Custom Loops.  I&#8217;ve used modified loops before &mdash; my present theme uses a modified loop to completely hide the Twitter archive posts for virtually every view &mdash; but not to this degree.  I&#8217;ve discovered how to create a loop that pulls posts by category names instead of the reference number, and then how to create a loop that <i>excludes<\/i> by category names.  This creates more coherent, more readable code under the hood.<\/p>\n<p>As a tangent, I&#8217;ve also discovered how to pull a page and display it by its page name.<\/p>\n<p>I am not sure if I need <a href=\"http:\/\/codex.wordpress.org\/Post_Types\">Post Types<\/a>.<\/p>\n<p>Right now, I&#8217;m about seventy percent of the way there to where I want to be with this new theme.  I need to do some work with widgets, and I need to do some work on the sidebar.php and the functions.php files.  Then, I need to create some of the ancillary files, like customized archive pages, tag pages, a 404 page, that kind of thing.<\/p>\n<p>And I need to think about typography, too.<\/p>\n<p>It&#8217;s not a priority.  Just something that&#8217;s fun to play with. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Two months ago, I wrote how I was planning a blog redesign. It&#8217;s not something I&#8217;ve worked on with any great alacrity; I don&#8217;t need it for another eight months. Basically, a nearly decade-old blog has outgrown its host, and I need to move it to another host, but my current hosting plan isn&#8217;t up<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=6059\">Continue reading <span class=\"screen-reader-text\">&#8220;On Writing More WordPress Code&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4095],"tags":[57,58,740,4096],"class_list":["post-6059","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-css","tag-php","tag-theme","tag-wordpress","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/6059","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=6059"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/6059\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6059"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6059"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6059"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}