{"id":31207,"date":"2018-03-29T20:40:21","date_gmt":"2018-03-30T01:40:21","guid":{"rendered":"http:\/\/www.allyngibson.com\/?p=31207"},"modified":"2018-03-30T09:10:02","modified_gmt":"2018-03-30T14:10:02","slug":"fighting-with-wordpress","status":"publish","type":"post","link":"http:\/\/www.allyngibson.com\/?p=31207","title":{"rendered":"Fighting With WordPress"},"content":{"rendered":"<p>A piece of WordPress coding that I thought would take about fifteen minutes ended up taking close to an hour and a half.<\/p>\n<p>I switched my blog theme recently from <a href=\"https:\/\/wordpress.org\/themes\/twentyseventeen\/\">Twenty Seventeen<\/a> (well, a child theme of it) to <a href=\"https:\/\/wordpress.org\/themes\/shoreditch\/\">Shoreditch<\/a> (again, a child theme of it, albeit one that I worked on in a flurry of activity in May 2016 and then didn&#8217;t touch again).  Shoreditch has a featured posts slider, and I was curious about it.<\/p>\n<p>Well, I can&#8217;t get it to work the way it&#8217;s supposed to &mdash; it&#8217;s supposed to pull six posts with a specific tag, but for some reason it&#8217;s pulling my six most recent posts &mdash; but that&#8217;s a problem I will dig into.<\/p>\n<p>The vexing thing, for me, was that for a slider, it didn&#8217;t <i>slide<\/i>.  If you want to see the six most recent posts, you have to click on tiny buttons beneath the slider to go through them.  I did some digging into the Shoreditch code, and I found what was controlling that, a js file that the parent theme loads.<\/p>\n<p>That&#8217;s editable, I thought, into what I want.  But since it&#8217;s bad form to edit the parent theme&#8217;s files &mdash; potential future upgrades would wipe out any changes I made &mdash; I knew I had to code a similar js file for my child theme, then &#8220;unload&#8221; (either by deregistration or denqueueing) the parent theme&#8217;s js.<\/p>\n<p>I thought this would take about fifteen minutes.  How hard could it be?<\/p>\n<p>Well, it turned into an hour and a half of trial-and-error.  What happens if I deregister this script?  The slider, for some reason, won&#8217;t load.  What if I denqueue that?  Now the page has a fatal error.  What if I remove this action (ie., tell WordPress not to bother with the function that loaded the scripts in the first place)?  Nothing.<\/p>\n<p>I had to experiment with various permutations of denqueue and deregister and even load priorities, and finally I found a combination that worked.<\/p>\n<p>So, for all that effort, the slider slides.  It&#8217;s not showing the content I want it to show, but there&#8217;s a slider, and it&#8217;s sliding.<\/p>\n<p>The content I want?  That&#8217;s a problem to solve another day.  The easiest solution there will probably be to write a loop with the same output format and avoid the Jetpack issue altogether.<\/p>\n<p>I don&#8217;t even remember why I gave up on Shoreditch two years ago.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A piece of WordPress coding that I thought would take about fifteen minutes ended up taking close to an hour and a half. I switched my blog theme recently from Twenty Seventeen (well, a child theme of it) to Shoreditch (again, a child theme of it, albeit one that I worked on in a flurry<a class=\"more-link\" href=\"http:\/\/www.allyngibson.com\/?p=31207\">Continue reading <span class=\"screen-reader-text\">&#8220;Fighting With WordPress&#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":[4642,4096],"class_list":["post-31207","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-wordpress","tag-shoreditch","tag-wordpress","entry"],"_links":{"self":[{"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/31207","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=31207"}],"version-history":[{"count":0,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=\/wp\/v2\/posts\/31207\/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=31207"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=31207"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.allyngibson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=31207"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}