“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 May 4th

  • 2018
    • Insecure / Unsecure Until yesterday I’ve been embarrassingly insecure about the security of my MacBookPro’s operating system. My friends in the field cringe when I confessed that on my 2013 machine I was still running the MacOS it came with, Mavericks. Part of it was that I heard friends mona about things lost on upgrades, and also, a […]
  • 2012
    • Fin: Final Projects Cross the Finish Line cc licensed ( BY ) flickr photo shared by Sean MacEntee And we are done! Everyone from ds106 Section 2 at University of Mary Washington, take a bow. Here are the final project highlights. If a project is missing please let me know (at least 2 I know of are not able to be viewed […]
  • 2011
    • Story a Day May #4: Stay/Go/Road Playlist Story Okay, none of y’all are dog enough to step up to the digital a story a day in may task, but this dog is going for the full ride. There is so much to choose from in the ds106 assignments submitted by participants, and if that is not enough, there is some place with like […]
  • 2010
    • Dead or Alive? cc licensed flickr photo shared by Justin Shearer On Saturday, unless my co-presenters have me kidnapped and dropped with cement shoes into False Creek, Brian Lamb, Chris Lott, and I are tossing out a Northern Voice 2010 session on I’m Not Dead Yet:.. Blogging Every few months some pundit posts something online stating that blogging […]
  • 2008
    • Pirate Update In the “I am not sure why people should care (but there are 80 people on Facebook who say they do) department– the latests news on my fight to escape the clutches of my mobile internet provider’s contract is that Alltel still has me in their brig. I’d like to say that I have a […]
  • 2007
    • Done with PodPress Plugin. Bye. I’ve tried for months to get the WordPress PodPress plugin to behave- on multiple sites it just plum refuses to embed the player in the page. Every option is set to display the player, I can see it in the source, and it fails. And it seems like it gets upgraded once a week, each […]
    • For A Spammer, Any Web Form is An Orifice Asking to Be Filled This is an old, tired, dog beaten story on this blog, but for the umpteenth time I’ve had to modify some web form that sis et up to collect data, because some script junkie decided to fill the form fields with PPC URLS (links to porn, pills, casinos, the un-holy trinity). It’s all in the […]
    • Arizona Flowers to Ireland: Nowpublic “Crowd Powered Media” What seem like everyday occurrences of connectivity across the web would have been beyond my wildest dreams back in the mid 1990s when just hand coding web pages and linking was intoxicating enough. I almost forgot about this interesting series of small events. In late march of this year, our daffodils started blooming up at […]
  • 2006
    • WordPress Theme Philosophy I thought it was longer, but it was only a bit over a year ago I switched from my MovableTyle CogDogBlog over to its incarnation in WordPress. Having rolled out perhaps 5 or 6 other WP blogs I was thinking of blogging out my strategy for dealing with some of the coolest aspects of Wp, […]
  • 2005
    • WordPress Search Bookmarklet As part of the blog transition I took a spin at creating a new tool that would create a WordPress search bookmarklet, more or less a quick re-do of the one I originally created for MovableType. It is even easier to construct for WordPress, as all you need to know is the base URL for […]
  • 2004
    • “Lo-Tec Tools for Creating Learning Objects” (or just describing ’em?) “Scissors, Scotch Tape, Post-its, Magic Markers and Colorforms: “LO-Tec” Tools (and Toys) for Creating Learning Objects” has been getting some blog echos [here, here, there…] but once again, I take on the role of Clara Peller and ask, “Where’s the Beef?” When we will stop the endless harping on creating metadata and do something with […]
    • Feeding the Feedback (“U Suk”) We crave feedback, right? That is the tickle bloggers get when there is email notification that someone has posted a comment. That is the reason why we build commenting features into system. It is what we look for in our online courses. It is what sends the blood boiling when spammers use this channel to […]
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 May 4th

  • 2018
    • Insecure / Unsecure Until yesterday I’ve been embarrassingly insecure about the security of my MacBookPro’s operating system. My friends in the field cringe when I confessed that on my 2013 machine I was still running the MacOS it came with, Mavericks. Part of it was that I heard friends mona about things lost on upgrades, and also, a […] &amp#x27A1;
  • 2012
    • Fin: Final Projects Cross the Finish Line cc licensed ( BY ) flickr photo shared by Sean MacEntee And we are done! Everyone from ds106 Section 2 at University of Mary Washington, take a bow. Here are the final project highlights. If a project is missing please let me know (at least 2 I know of are not able to be viewed […] &amp#x27A1;
  • 2011
    • Story a Day May #4: Stay/Go/Road Playlist Story Okay, none of y’all are dog enough to step up to the digital a story a day in may task, but this dog is going for the full ride. There is so much to choose from in the ds106 assignments submitted by participants, and if that is not enough, there is some place with like […] &amp#x27A1;
  • 2010
    • Dead or Alive? cc licensed flickr photo shared by Justin Shearer On Saturday, unless my co-presenters have me kidnapped and dropped with cement shoes into False Creek, Brian Lamb, Chris Lott, and I are tossing out a Northern Voice 2010 session on I’m Not Dead Yet:.. Blogging Every few months some pundit posts something online stating that blogging […] &amp#x27A1;
  • 2008
    • Pirate Update In the “I am not sure why people should care (but there are 80 people on Facebook who say they do) department– the latests news on my fight to escape the clutches of my mobile internet provider’s contract is that Alltel still has me in their brig. I’d like to say that I have a […] &amp#x27A1;
  • 2007
    • Done with PodPress Plugin. Bye. I’ve tried for months to get the WordPress PodPress plugin to behave- on multiple sites it just plum refuses to embed the player in the page. Every option is set to display the player, I can see it in the source, and it fails. And it seems like it gets upgraded once a week, each […] &amp#x27A1;
    • For A Spammer, Any Web Form is An Orifice Asking to Be Filled This is an old, tired, dog beaten story on this blog, but for the umpteenth time I’ve had to modify some web form that sis et up to collect data, because some script junkie decided to fill the form fields with PPC URLS (links to porn, pills, casinos, the un-holy trinity). It’s all in the […] &amp#x27A1;
    • Arizona Flowers to Ireland: Nowpublic “Crowd Powered Media” What seem like everyday occurrences of connectivity across the web would have been beyond my wildest dreams back in the mid 1990s when just hand coding web pages and linking was intoxicating enough. I almost forgot about this interesting series of small events. In late march of this year, our daffodils started blooming up at […] &amp#x27A1;
  • 2006
    • WordPress Theme Philosophy I thought it was longer, but it was only a bit over a year ago I switched from my MovableTyle CogDogBlog over to its incarnation in WordPress. Having rolled out perhaps 5 or 6 other WP blogs I was thinking of blogging out my strategy for dealing with some of the coolest aspects of Wp, […] &amp#x27A1;
  • 2005
    • WordPress Search Bookmarklet As part of the blog transition I took a spin at creating a new tool that would create a WordPress search bookmarklet, more or less a quick re-do of the one I originally created for MovableType. It is even easier to construct for WordPress, as all you need to know is the base URL for […] &amp#x27A1;
  • 2004
    • “Lo-Tec Tools for Creating Learning Objects” (or just describing ’em?) “Scissors, Scotch Tape, Post-its, Magic Markers and Colorforms: “LO-Tec” Tools (and Toys) for Creating Learning Objects” has been getting some blog echos [here, here, there…] but once again, I take on the role of Clara Peller and ask, “Where’s the Beef?” When we will stop the endless harping on creating metadata and do something with […] &amp#x27A1;
    • Feeding the Feedback (“U Suk”) We crave feedback, right? That is the tickle bloggers get when there is email notification that someone has posted a comment. That is the reason why we build commenting features into system. It is what we look for in our online courses. It is what sends the blood boiling when spammers use this channel to […] &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.

    If this kind of stuff has value, please support me by tossing a one time PayPal kibble or monthly on Patreon
    Become a patron at Patreon!
    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 *