{"id":6609,"date":"2012-09-15T14:04:50","date_gmt":"2012-09-15T19:04:50","guid":{"rendered":"http:\/\/www.allyngibson.net\/?p=6609"},"modified":"2012-09-15T14:04:50","modified_gmt":"2012-09-15T19:04:50","slug":"on-more-coding-thoughts","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=6609","title":{"rendered":"On More Coding Thoughts"},"content":{"rendered":"<p>Yes, I&#8217;ve been away.  Crushing deadlines will that to a person.<\/p>\n<p>Tomorrow, I promise my long-awaited blog post on <i>Star Trek: The Next Generation\/Doctor Who<\/i>: <i>Assimilation<sup>2<\/sup><\/i> #4.  It&#8217;s something I&#8217;ve been wrestling with for about two weeks now.<\/p>\n<p>At the moment, though, I&#8217;m going to write about where things are with my website redesign.<\/p>\n<p><b>1) Mobile<\/b><\/p>\n<p>I thought about trying to figure out how to make the theme I&#8217;m using responsive to display width.  I spent some time studying CSS code for some other WordPress themes, looking at how others made the <a href=\"http:\/\/960.gs\/\">960 Grid<\/a> responsive, that sort of thing.<\/p>\n<p>I decided, instead, to make things easy.<\/p>\n<p>I was pointed in the direction of a WordPress plugin, <a href=\"http:\/\/wordpress.org\/extend\/plugins\/device-theme-switcher\/\">Device Theme Switcher<\/a>.  This plugin enables a site to serve a different theme if someone arrives on a mobile phone or a tablet, and you can specify themes for both eventualities.<\/p>\n<p>For the mobile phone, I&#8217;m going to use <a href=\"http:\/\/en.blog.wordpress.com\/2011\/11\/02\/new-mobile-theme-minileven\/\">Minileven<\/a> as the theme.  For tablets, I will probably use <a href=\"http:\/\/en.blog.wordpress.com\/2012\/08\/28\/new-theme-twenty-twelve\/\">Twenty Twelve<\/a> once that&#8217;s released for self-hosted WordPress.<\/p>\n<p>Both I&#8217;ll modify somewhat with child themes to factor in some of the customizations I&#8217;m putting into my main theme.<\/p>\n<p><b>2) Custom Taxonomy<\/b><\/p>\n<p>I need to create a custom taxonomy for a specific type of post.  I could manage this classification through either Categories or Tags, but that has disadvantages and would muddle things up elsewhere in the site.  I could also use Custom Fields on the fly, but that wouldn&#8217;t be as easy or convenient in regular use.  A custom taxonomy would give me an extra meta box with a checkbox on the post composition screen to mark these posts as they&#8217;re made.  It&#8217;s more code on the back-end, but the end result is convenience.  The base theme I&#8217;m building off of uses a custom taxonomy, so I should be able to modify that code to my ends then modify the loop that I currently have to pull posts from that taxonomy.<\/p>\n<p><b>3) Custom Menu\/Walker<\/b><\/p>\n<p>Something I&#8217;ve hard-coded into the front page I think would be better handled as a custom menu.  This would give me the flexibility to change the three links provided as I see fit through the WordPress menu management system rather than editing my code directly.  To accomplish this, I&#8217;ll need to write a custom walker to pull post thumbnails for this &#8220;menu.&#8221;  I have some example code, so this shouldn&#8217;t be more than an evening&#8217;s worth of work to code and test.<\/p>\n<p><b>4) Sticky Post<\/b><\/p>\n<p>I&#8217;m not sure that I need and\/or want this.  The base theme I&#8217;m working with implements the sticky post in an interesting way, but because I&#8217;ve created a custom homepage marking something as a sticky post has no effect.  I&#8217;m not sure if it&#8217;s something I need to implement (in other words, find a place for) or if I can function without it.  To be honest, I&#8217;m not sure that I need it.  However, it might be better to implement it, but put a conditional on it so that if there isn&#8217;t a sticky post then that section of the homepage drops away.  This will require some thought, because I&#8217;ll also have to decide <i>where<\/i> it will go.<\/p>\n<p><b>5) Drabbles<\/b><\/p>\n<p>How to handle these, that&#8217;s the question.  They&#8217;re in a separate database in my current WordPress installation, handled by a long-out-of-date plugin called <a href=\"http:\/\/wordpress.org\/extend\/plugins\/miniblog\/\">Miniblog<\/a>.  I&#8217;d much rather move these into the standard WordPress database tables, but then it becomes a question of how to display them &mdash; and <b>not<\/b> display them.<\/p>\n<p>It&#8217;s going to require this code (<a href=\"http:\/\/www.brunofernandes.com\/how-to-exclude-categories-from-homepage-feeds-and-archives-of-your-wordpress-website\/\">from this website<\/a>), I think&#8230;<\/p>\n<p><code>add_action('pre_get_posts', 'exclude_categories_' );<\/p>\n<p>function exclude_categories_($toExclude) {<br \/>\n&nbsp;&nbsp;global $wp_query; \/\/ Use this variable to assign the categories to exclude<br \/>\n&nbsp;&nbsp;$categoriesExclude = '-3 -10 -11'; \/\/this is just an example. Change the ids to fit your needs<br \/>\n&nbsp;&nbsp;\/\/ this example will exclude the categories assigned to the $categoriesExclude variable<br \/>\n&nbsp;&nbsp;\/\/from homepage, archives pages, feeds but not from categories pages<br \/>\n&nbsp;&nbsp;if( is_home() || is_feed() ||( is_archive() &amp;&amp; !is_category() )) {<br \/>\n&nbsp;&nbsp;&nbsp;&nbsp;$wp_query-&gt;query_vars['cat'] = $categoriesExclude;<br \/>\n&nbsp;&nbsp;}<br \/>\n}<\/code><\/p>\n<p>With modifications, of course.  That will get me started (and it will keep me from having to recode other loops), but I&#8217;ll also need to create a page template to handle their display in the way that I want them displayed.<\/p>\n<p>I&#8217;m sure there&#8217;s something I&#8217;m forgetting, but those are the five big areas that are preoccupying me with the WordPress coding at the moment.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Yes, I&#8217;ve been away. Crushing deadlines will that to a person. Tomorrow, I promise my long-awaited blog post on Star Trek: The Next Generation\/Doctor Who: Assimilation2 #4. It&#8217;s something I&#8217;ve been wrestling with for about two weeks now. At the moment, though, I&#8217;m going to write about where things are with my website redesign. 1)<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=6609\">Continue reading <span class=\"screen-reader-text\">&#8220;On More Coding Thoughts&#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":[226,227,4096],"class_list":["post-6609","post","type-post","status-publish","format-standard","hentry","category-wordpress","tag-blog","tag-coding","tag-wordpress","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/6609","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=6609"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/6609\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=6609"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=6609"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=6609"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}