“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 15 posts previously published on June 1st

  • 2016
    • It’s Like Riding an Infographic You really cannot make this stuff up, but someone out there actually does… There are bad visualizations, and then there's the 'bicycle of education'. pic.twitter.com/seigDh715h— Tim van der Zee (@Research_Tim) May 31, 2016 Take a look at that imagery- is that a bicycle anyone wants to ride? Is that an education anyone wants? Can you […]
  • 2015
    • Leaving #TWP15 Tracks This is just making sure there’s a post in the category in the feed that connects to the Teaching with WordPress thing going on at UBC, being led by good colleagues and friends there. I’ve been using WordPress since April 2005, when it was version. Why do I know that? Because I have a blog […]
    • If You Have a Problem with Your Twitter Account, You are SOL? The difference between the photo above and trying to get help from twitter is that there are no dogs on the inside of the door. A new twitter account created for an upcoming educational project in Mexico– essentially does not exist beyond the limits of looking at the account. Yet I get bombarded daily by […]
  • 2013
    • Slowing on Down the Road Last week in Vermont I took a walk down the same country road I drive when I left the area in September. Going at walking speed I was blown over by how much detail and information I missed on the faster pass. And there is some sort of life lesson that a gazillion have written […]
  • 2012
    • The Shape of Cool Hand Luke cc licensed ( BY ) flickr photo shared by cogdogblog This is a fairly literal attempt to draw the shape of the story to one of my favorite all time films, Cool Hand Luke (1967) according to the Kurt Vonnegut approach: In the beginning, since he is drunk and feeling no pain, Paul Newman’s character […]
  • 2011
    • Sneak Preview! Amazing Stories of Openness 2011 I’m releasing a day early the collection of Amazing Stories of Openness I will show tomorrow at the opening of the ETUG Spring Workshop in Nelson, BC. These are just the videos, for the session, I have a few surprises up my sleeve, and may even gamble on doing a chunk of this w/o any […]
    • My PirateBox is a StoryBox cc licensed ( BY ) flickr photo shared by cogdogblog This little case is going to contain an entire four months of shared, gathered experience on my road tour. Built as a way to easily, anonymously share files and chat over a local network (see David Darts hub site for full details). It establishes a […]
  • 2009
    • Twitter Archaeology cc licensed flickr photo shared by cogdogblog My First Tweet is supposed to find your first chirped status, but it apparently fails if you have gone past the 3000 mark. There used to be a way to manually page back through your twitter archive by munging the page=XX value of the old URLs… but they […]
  • 2008
    • The Stump Thunk The Punk Stunk To paraphrase an old favorite tongue-twister: A punk sat on a stump. The punk thunk the stump thunk, but the stump thunk the punk stunk My blog hat is humbly dipped to the east to Jim Groom for feverishly launching the spreading EDUPUNK meme (must be in all caps, eh). That photo is scary enough. […]
  • 2007
    • I Get Web 2.0ed With a Little Help From My Friends It’s the day before I board the Big Old Jet Airliner to the NMC Summer Conference and I am piling on the Web 2.0 Tagging goodness, or zaniness. This recap is as much to document as to thanks those I lean on. Last year, at the 2006 Summer conference in Cleveland, being my first one […]
  • 2005
    • Watch A Web Site Design Unfold Before Your Eyes This might be a sideways version of a screen cast. At Mboffin.com, Dylan created an animated GIF that shows a screen shot captures for each change as a web site was developed. You can watch it evolve from un-formatted semantic HTML through different iterations of font sizes, creation of the page elements, etc. It’s a […]
    • (Softly) Banging WordPress I’ve not had nearly the desired time to monkey around in WordPress (hence the near stock template), but I am hoping over the more slow time of summer to slowly add and tinker and perhaps break. I am still trying to get my mind around the template/tag structure, which is fairly sensible. What I’d really […]
    • Doing The Comic Thang One can be a busy blogger just copying the neat things D’Arcy Norman does… liks playing with the gnomz comic creator he wrote about a while back. This is just one of those things that at first you might thing, “What a silly waste of time and computer resources!”, which is true, but don’t be […]
    • Jots Rocks After toying a bit with Jots yesterday getting the bookmarklet tool to work, I am getting to like it more and more as a bookmark manager. I might be switching from ‘furling’ to ‘jotting’… It more or less has everything you get with del.icio.us, meaning easy bookmarking, searching, tagging, rss feeds, seeing what others are […]
  • 2003
    • Happy 50th, DNA Wow, actually I thought the 2003 Double Helix Celebrations site would be a “good dog.” After all, a historical look at the 50th anniversary of Watson and Crick’s discovery of the DNA double helix structure, should be a gold mine.  Share this barking on social media
and the default value, the link at the end is invisible.

On Michael’s site he might use

There are 15 posts previously published on June 1st

  • 2016
    • It’s Like Riding an Infographic You really cannot make this stuff up, but someone out there actually does… There are bad visualizations, and then there's the 'bicycle of education'. pic.twitter.com/seigDh715h — Tim van der Zee (@Research_Tim) May 31, 2016 Take a look at that imagery- is that a bicycle anyone wants to ride? Is that an education anyone wants? Can […] &amp#x27A1;
  • 2015
    • Leaving #TWP15 Tracks This is just making sure there’s a post in the category in the feed that connects to the Teaching with WordPress thing going on at UBC, being led by good colleagues and friends there. I’ve been using WordPress since April 2005, when it was version. Why do I know that? Because I have a blog […] &amp#x27A1;
    • If You Have a Problem with Your Twitter Account, You are SOL? The difference between the photo above and trying to get help from twitter is that there are no dogs on the inside of the door. A new twitter account created for an upcoming educational project in Mexico– essentially does not exist beyond the limits of looking at the account. Yet I get bombarded daily by […] &amp#x27A1;
  • 2013
    • Slowing on Down the Road Last week in Vermont I took a walk down the same country road I drive when I left the area in September. Going at walking speed I was blown over by how much detail and information I missed on the faster pass. And there is some sort of life lesson that a gazillion have written […] &amp#x27A1;
  • 2012
    • The Shape of Cool Hand Luke cc licensed ( BY ) flickr photo shared by cogdogblog This is a fairly literal attempt to draw the shape of the story to one of my favorite all time films, Cool Hand Luke (1967) according to the Kurt Vonnegut approach: In the beginning, since he is drunk and feeling no pain, Paul Newman’s character […] &amp#x27A1;
  • 2011
    • Sneak Preview! Amazing Stories of Openness 2011 I’m releasing a day early the collection of Amazing Stories of Openness I will show tomorrow at the opening of the ETUG Spring Workshop in Nelson, BC. These are just the videos, for the session, I have a few surprises up my sleeve, and may even gamble on doing a chunk of this w/o any […] &amp#x27A1;
    • My PirateBox is a StoryBox cc licensed ( BY ) flickr photo shared by cogdogblog This little case is going to contain an entire four months of shared, gathered experience on my road tour. Built as a way to easily, anonymously share files and chat over a local network (see David Darts hub site for full details). It establishes a […] &amp#x27A1;
  • 2009
    • Twitter Archaeology cc licensed flickr photo shared by cogdogblog My First Tweet is supposed to find your first chirped status, but it apparently fails if you have gone past the 3000 mark. There used to be a way to manually page back through your twitter archive by munging the page=XX value of the old URLs… but they […] &amp#x27A1;
  • 2008
    • The Stump Thunk The Punk Stunk To paraphrase an old favorite tongue-twister: A punk sat on a stump. The punk thunk the stump thunk, but the stump thunk the punk stunk My blog hat is humbly dipped to the east to Jim Groom for feverishly launching the spreading EDUPUNK meme (must be in all caps, eh). That photo is scary enough. […] &amp#x27A1;
  • 2007
    • I Get Web 2.0ed With a Little Help From My Friends It’s the day before I board the Big Old Jet Airliner to the NMC Summer Conference and I am piling on the Web 2.0 Tagging goodness, or zaniness. This recap is as much to document as to thanks those I lean on. Last year, at the 2006 Summer conference in Cleveland, being my first one […] &amp#x27A1;
  • 2005
    • Watch A Web Site Design Unfold Before Your Eyes This might be a sideways version of a screen cast. At Mboffin.com, Dylan created an animated GIF that shows a screen shot captures for each change as a web site was developed. You can watch it evolve from un-formatted semantic HTML through different iterations of font sizes, creation of the page elements, etc. It’s a […] &amp#x27A1;
    • (Softly) Banging WordPress I’ve not had nearly the desired time to monkey around in WordPress (hence the near stock template), but I am hoping over the more slow time of summer to slowly add and tinker and perhaps break. I am still trying to get my mind around the template/tag structure, which is fairly sensible. What I’d really […] &amp#x27A1;
    • Doing The Comic Thang One can be a busy blogger just copying the neat things D’Arcy Norman does… liks playing with the gnomz comic creator he wrote about a while back. This is just one of those things that at first you might thing, “What a silly waste of time and computer resources!”, which is true, but don’t be […] &amp#x27A1;
    • Jots Rocks After toying a bit with Jots yesterday getting the bookmarklet tool to work, I am getting to like it more and more as a bookmark manager. I might be switching from ‘furling’ to ‘jotting’… It more or less has everything you get with del.icio.us, meaning easy bookmarking, searching, tagging, rss feeds, seeing what others are […] &amp#x27A1;
  • 2003
    • Happy 50th, DNA Wow, actually I thought the 2003 Double Helix Celebrations site would be a “good dog.” After all, a historical look at the 50th anniversary of Watson and Crick’s discovery of the DNA double helix structure, should be a gold mine.  Share this barking on social media &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 *