{"id":31229,"date":"2018-04-09T06:38:10","date_gmt":"2018-04-09T11:38:10","guid":{"rendered":"http:\/\/www.allyngibson.com\/?p=31229"},"modified":"2018-04-09T06:39:36","modified_gmt":"2018-04-09T11:39:36","slug":"getting-closer","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=31229","title":{"rendered":"Getting Closer"},"content":{"rendered":"<p>Friday night, following a week of deadlines and deadlines and more deadlines, I spent some time working on my website&#8217;s code.<\/p>\n<p>Two weeks ago, I wrote that <a href=\"http:\/\/www.allyngibson.com\/?p=31207\">I&#8217;d been fighting with the blog theme&#8217;s slider<\/a>; the parent theme, <a href=\"https:\/\/wordpress.org\/themes\/shoreditch\/\">Shoreditch<\/a>, had a featured content section, but it didn&#8217;t <i>slide<\/i>.  Instead, it paged with some controls.  The JS library used was certainly capable of &#8220;sliding,&#8221; and that meant working out how to replace some of the settings when the slider JS loaded.<\/p>\n<p>Last weekend, I spent some time working on code that would display the content I wanted in the featured slider.  The Shoreditch slider uses the <a href=\"https:\/\/jetpack.com\/support\/featured-content\/\">Featured Content<\/a> in Jetpack, a collection of WordPress tools, and while the slider was theoretically set up to pull posts (and pages) with a specific tag, in my experience all it pulled was the six most recent posts, regardless of how they were tagged.  It seemed to me that if I turned off the Jetpack Featured Content, then I could create a custom loop for the featured slider.  I experimented with add_filter calls and remove_filter calls.  I tried overwriting Shoreditch&#8217;s settings with an add_theme_support call, and I finally discovered remove_theme_support which accomplished exactly what I needed.  While that accomplished what I wanted &mdash; turning off Jetpack&#8217;s Featured Content function, when I tried passing my own custom loop for the featured content area, then I essentially ended up back where I started, with my six most recent posts in the slider.  So, I deleted one file from the server (the one that had my custom loop) and commented out the remove_theme_support call in my functions.php file, which put things back to how they had been before I started so I could tackle the problem another day.<\/p>\n<p>After I started looking at the Shoreditch theme again a few weeks ago, I couldn&#8217;t understand why I&#8217;d given up on it two years ago.  It&#8217;s an attractive theme, I like how it looks, it&#8217;s very readable.  <a href=\"http:\/\/www.allyngibson.com\/?p=30020\">I was excited by it<\/a> in May 2016.  What happened?  I must have tilted at the windmill of that featured content slider and concluded life was too short to solve its mysteries.  Age, wisdom, or stupidity brought me back to it.<\/p>\n<p>This weekend brought me back to the custom loop problem.  It took about two hours between Friday and Saturday of coding, testing, and recoding, and at last I got it.<\/p>\n<p>I&#8217;m not sure why I hadn&#8217;t gotten it to work a week earlier.  I suspect I was passing a bad argument to wp_new_query which it didn&#8217;t know how to handle so it fell back to most recent posts.  The query works by pulling posts with a specific tag (like the Jetpack function did), only unlike the Jetpack function it works.  The Jetpack function also hid the tag from readers on the front-end because it&#8217;s meaningless to them, and I wanted to do the same thing.  I experimented with modifying that function from the Jetpack code, which caused an explosion of PHP errors, so I turned instead to the Googles, and I found the code that I needed on StackExchange.<\/p>\n<p>Now that I have a slider that works, that I can control, I can modify the custom loop into whatever I want.  In other words, what I&#8217;m currently displaying in the slider &mdash; five recent-ish posts that I find interesting &mdash; isn&#8217;t what I have in mind for the area.<\/p>\n<p>The site is moving incrementally closer to what this ink-stained wretch wants. \ud83d\ude42<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Friday night, following a week of deadlines and deadlines and more deadlines, I spent some time working on my website&#8217;s code. Two weeks ago, I wrote that I&#8217;d been fighting with the blog theme&#8217;s slider; the parent theme, Shoreditch, had a featured content section, but it didn&#8217;t slide. Instead, it paged with some controls. The<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=31229\">Continue reading <span class=\"screen-reader-text\">&#8220;Getting Closer&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":31208,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4095],"tags":[4671,4670,4096],"class_list":["post-31229","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-featured-content","tag-jetpack","tag-wordpress","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/31229","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=31229"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/31229\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/media\/31208"}],"wp:attachment":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=31229"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31229"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31229"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}