“Who ya gonna call?” “CODEBUSTERS”

No.

But the metaphor of Ghostbusters crossing the streams was inversely appropriate to a little bit of code action over the holidays (of which the actual action was nil).

But this was fun.

This nice tweet from John Johnston (who spawned the idea) reminded me of a WordPress plugin I had made

The WP Posted Today plugin is meant to offer a short code you can put on a site and it will list all previous posts on the current calendar day (this of course is useful if you actually still blog regularly) (cough) (cough).

Just for grins I checked the page where I use my own plugin. Yikes. Red Alert. It displayed all the ones for December 29 in years past, but the part where it should list how many there were was blank.

Red arrow points to missing number where the page output reads "There are posts previously published on December 29th"

I dug into my own code… and found myself a bit lost. Crossed. I was not even sure where I got the sprintf functions (John’s original code?) that were aimed to be compatible if anyone every wanted a language translation (maybe, or it’s just that thing when people code things differently).

Taking the path of least resistance, I took out the code where I think the problem was occurring and did it a more simple, but brute force way.

And it worked.

So I updated the version on GitHub and felt at peace with the world. In the off chance someone stumbled into my little corner of code, they would find something that works (or should work).

And then (here comes a stream crossing) Michael Hanscom @djwudi — someone I don’t think I’ve ever communicated with — tweets that he had seen pretty much the same bug and offered a fix.

https://twitter.com/djwudi/status/1212871226953101313

In looking at his post I saw the fix he made, and said– that’s better than mine! So I decided today to roll back my changes in place of Michael’s solution (but also keeping a modification I had made to remove extraneous calls when not needed for singular versus multiple results).

I noted the extra change he made in hos own version

Plus, I’ve made one other tweak to the plugin, so that it adds a link to the end of the excerpt to better handle “microblog” style entries that don’t have titles, so I still get to feel good about that part, as well. 🙂 My coding skills may be underdeveloped and rusty from lack of regular use, but they’re not entirely atrophied!

In this case, these microblog type entries (see Michael’s demo page) lack titles, so yes, a link is needed at the end of the post excerpt.

Yet I could see that regular posts (like on my site) did not need the extra link, and also, not everyone might want the arrow Michael likes.

I solved this cleverly by creating an additional shortcode parameter more which defaults to a blank string. In the shortcode function, we convert any attributes passed to variables with

extract(shortcode_atts( array( "month" => '', "day" => '', 'excerpt' => 1, 'more' => '' ), $atts ));

So on my site, where I just used the shortcode

There are 12 posts previously published on August 1st

  • 2019
    • Congratulations, Mrs. SPLOT, It’s a Plugin After a longer than expected delivery period, the baby is breathing. Now it’s time for some folks to give it a tickle. There are two sites now running the very first versions of the TRU Writer SPLOT running completely as a WordPress plugin. This means rather than the functionality being coded into a child theme […]
  • 2017
    • First Apple Pie of 2017 is explored Hello flickr explore, it’s been a while…. Perhaps you were hungry The thing is there’s not a whole lot to say about the photo. It’s a pie. It’s the first home made apple pie of 2017, as my tree has a pretty good amount of fruit on it. The recipe is not a family secret, […]
  • 2016
    • Slicing Through the Water Knife I’m reading along side Bryan Alexander and others in his “near-future” science fiction reading “club” (is it a club? a group?). What does one do in a reading group? I guess you read! Outlining the reasons for joining along and the braided stream of connections to his choice of Paolo Bacigalupi’s The Water Knife may […]
  • 2015
    • Rinsed and Ready Wow, another in explore achievement for a photo I might have not picked myself. I thought this was happening when my phone starting pinging with a bunch of flickr likes from names I do not recognize. It makes me giddy, so I had to write the post now. Flickr does not tell you when they […]
  • 2013
    • So You Want to Help Manage ds106 Radio? cc licensed ( BY SA ) flickr photo shared by Alan Levine I am going to assume the answer is “yes” “EFF YEAH I AM #4FLIFE” We still have some server quirks to try and figure out, like getting live stream meta data to display, and some indication of when a live broadcast is going […]
    • Building Out the [New] ds106 Assignment Bank It’s time to get all wide-eyed and get started on my August project- to recast the ds106 Assignment Bank into a wordpress theme that would have the functionality built into it for people to create other kinds of sites with the same features. The first step was to create the development site, which shall remain […]
  • 2010
    • Going With the Flow Sometimes you have trips with very well defined and choreographed itineraries, where you know what is/should be happening down to some overly detailed level of detail. This week has not been one of those, it’s been more of going with the flow. And that’s ok. A planned trip to visit friends in Monterey was built […]
  • 2009
    • Pretty Code After years of publishing snippets of HTML and PHP code in this blog, I’ve yet to find an elegant way to represent the code when published- there’s a bit of a trick, since you don’t want the HTML or PHP to do what it normally does. For a few years I have used the Preserve […]
    • View Source Messages One of my web hobbies is peeking at the source code of web pages– and I love it when you find something there that does not make the front page, and HTML Easter Egg if you will. I actually do this if I am trying to see how something was coded for a page or […]
  • 2008
    • A Different Way to Make a Plugin While I tinker with them, I’ve yet to code my own WordPress plugin. There are so many to choose from! A few weeks ago I got an email from a guy named Joe who I had met at Northern Voice. He was developing a plugin that would connect blog posts automatically to related content in […]
  • 2007
    • The New Polaroid is TypePad Can you remember the anticipation of counting to 60 before peeling back those Polaroid photos, juts hoping Aunt Maybelle was smiling or little Jimmy did not have his finger up his nose? The smell of the chemicals as it revealed what more often than not was not realistic colors? Is that how we do photos […]
  • 2003
    • Onward to Vancouver for a Gulp of MERLOT Just a few days until I leave (Monday), heading northwest to beautiful Vancouver for the MERLOT 2003 conference. In addition to putting on a poster (and a completely unposter-like poster at that!) on the Maricopa Learning eXchange (MLX), I am teaming up with compadres Brian Lamb and D’Arcy Norman for a session covering our work […]
and the default value, the link at the end is invisible.

On Michael’s site he might use

There are 12 posts previously published on August 1st

  • 2019
    • Congratulations, Mrs. SPLOT, It’s a Plugin After a longer than expected delivery period, the baby is breathing. Now it’s time for some folks to give it a tickle. There are two sites now running the very first versions of the TRU Writer SPLOT running completely as a WordPress plugin. This means rather than the functionality being coded into a child theme […] &amp#x27A1;
  • 2017
    • First Apple Pie of 2017 is explored Hello flickr explore, it’s been a while…. Perhaps you were hungry The thing is there’s not a whole lot to say about the photo. It’s a pie. It’s the first home made apple pie of 2017, as my tree has a pretty good amount of fruit on it. The recipe is not a family secret, […] &amp#x27A1;
  • 2016
    • Slicing Through the Water Knife I’m reading along side Bryan Alexander and others in his “near-future” science fiction reading “club” (is it a club? a group?). What does one do in a reading group? I guess you read! Outlining the reasons for joining along and the braided stream of connections to his choice of Paolo Bacigalupi’s The Water Knife may […] &amp#x27A1;
  • 2015
    • Rinsed and Ready Wow, another in explore achievement for a photo I might have not picked myself. I thought this was happening when my phone starting pinging with a bunch of flickr likes from names I do not recognize. It makes me giddy, so I had to write the post now. Flickr does not tell you when they […] &amp#x27A1;
  • 2013
    • So You Want to Help Manage ds106 Radio? cc licensed ( BY SA ) flickr photo shared by Alan Levine I am going to assume the answer is “yes” “EFF YEAH I AM #4FLIFE” We still have some server quirks to try and figure out, like getting live stream meta data to display, and some indication of when a live broadcast is going […] &amp#x27A1;
    • Building Out the [New] ds106 Assignment Bank It’s time to get all wide-eyed and get started on my August project- to recast the ds106 Assignment Bank into a wordpress theme that would have the functionality built into it for people to create other kinds of sites with the same features. The first step was to create the development site, which shall remain […] &amp#x27A1;
  • 2010
    • Going With the Flow Sometimes you have trips with very well defined and choreographed itineraries, where you know what is/should be happening down to some overly detailed level of detail. This week has not been one of those, it’s been more of going with the flow. And that’s ok. A planned trip to visit friends in Monterey was built […] &amp#x27A1;
  • 2009
    • Pretty Code After years of publishing snippets of HTML and PHP code in this blog, I’ve yet to find an elegant way to represent the code when published- there’s a bit of a trick, since you don’t want the HTML or PHP to do what it normally does. For a few years I have used the Preserve […] &amp#x27A1;
    • View Source Messages One of my web hobbies is peeking at the source code of web pages– and I love it when you find something there that does not make the front page, and HTML Easter Egg if you will. I actually do this if I am trying to see how something was coded for a page or […] &amp#x27A1;
  • 2008
    • A Different Way to Make a Plugin While I tinker with them, I’ve yet to code my own WordPress plugin. There are so many to choose from! A few weeks ago I got an email from a guy named Joe who I had met at Northern Voice. He was developing a plugin that would connect blog posts automatically to related content in […] &amp#x27A1;
  • 2007
    • The New Polaroid is TypePad Can you remember the anticipation of counting to 60 before peeling back those Polaroid photos, juts hoping Aunt Maybelle was smiling or little Jimmy did not have his finger up his nose? The smell of the chemicals as it revealed what more often than not was not realistic colors? Is that how we do photos […] &amp#x27A1;
  • 2003
    • Onward to Vancouver for a Gulp of MERLOT Just a few days until I leave (Monday), heading northwest to beautiful Vancouver for the MERLOT 2003 conference. In addition to putting on a poster (and a completely unposter-like poster at that!) on the Maricopa Learning eXchange (MLX), I am teaming up with compadres Brian Lamb and D’Arcy Norman for a session covering our work […] &amp#x27A1;
to get the arrow codes he likes. This works because output for each found post looks like

// output post and link
			
$output .= '
  • ' . get_the_title() . ''; // display excerpt if we want it if ( $excerpt ) $output .= ' ' . get_the_excerpt(); // for microblog output where there might not be titles so add a link at end // h/t https://www.michaelhanscom.com/eclecticism/2020/01/02/rss-feed-weirdness-and-php-debugging/ $output .= ' ' . $more . '
  • ';

    So how is that for the odds of streams crossing on the same obscure bit of code? That’s the old fashioned kind of net serendipity that still happens.

    Thanks Michael! Check out his 20 year old blog, he’s an “Enthusiastically Ambiverted Hopepunk” quite the tag line.


    Featured Image: Edit of the Ghostbusters Cross Streams scene found in the Ghostbusters Fandom Wiki site which states “Community content is available under CC-BY-SA unless otherwise noted.” I replaced part of the background with a screenshot of the WP Posted Today PHP code.

    Profile Picture for CogDog The Blog
    An early 90s builder of web stuff and blogging Alan Levine barks at CogDogBlog.com on web storytelling (#ds106 #4life), photography, bending WordPress, and serendipity in the infinite internet river. He thinks it's weird to write about himself in the third person. And he is 100% into the Fediverse (or tells himself so) Tooting as @cogdog@cosocial.ca

    Leave a Reply

    Your email address will not be published. Required fields are marked *