“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.
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.
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 10 posts previously published on March 18th
- 2012
- Reading “Rear Window” A few weeks ago Jim Groom and I watched Rear Window, a classic film on many levels- you cannot go wrong with picking a Hitchcock film to analyze. I hardly consider myself a film critic, and what I write below comes from my own perspective, not having read any reviews or Wikipedia entries. The goal […]
- Doing Your Self Out of What You Say You Can’t Do: 0 to Radio Show in 2 weeks In which I open a blog post with the worst grammatical title of the… wek? cc licensed ( BY ) flickr photo shared by stevendepolo In the ds106 classes here at UMW, we’ve just moved past week 8, and one of the grueling stretches for students in their projects to produce 30 minutes of an […]
- Bryan Alexander Paints Four Futures for Education cc licensed ( BY ) flickr photo shared by cogdogblog This guy not only sees far, but makes it understandable for us- not simplified, but approachable. What a treat in my first week of work at the University of Mary Washington to have Bryan Alexander come for a 2 day visit. He might be the […]
- Daily Create Recaps (though March 18) So much going on lately, so little blogged, time to re-train this blog dog. The activity on the Daily Creates seems to have dovetailed a bit, likely as other people are hitting this same stretch. Yet, I want to practice what I say in that while the challenge is daily, there is zero reason to […]
- 2011
- This Arizonan Life THIS WEEK ARIZONA TRUTHS BROADCAST MAR 18, 2011 We look for the truth in Arizona, starting with the real age of the earth, as well as the headless bodies in the desert, legislators on ice, and something truly amazing buried in an old mine shaft. Where is the truth? We find it. —————————————————– This was […]
- Road Rambles cc licensed ( BY NC ) flickr photo shared by sendarko I have been deeply touched by the (most ever at CDB) comments to my Into the Great Wide Open post as well as the #roadsongs shared on ds106 radio yesterday, masterfully conducted by the dog’s favorite bava. Late last night (after midnight here on […]
- 2010
- Chrome Dog (króm hundur) cc licensed flickr photo shared by mrphancy I’ve been a few weeks into using Google Chrome, and sorry Old Fox, the shiny metal is looking and feeling good. With Firefox, it was a long running period of spending time I’d rather be browsing waiting for Mac Beachballs to stop spinning, or that pause when a […]
- 2009
- Look for me at Sundance My Next Blockbuster from the Movie Plot Generator by cogdogblog posted 18 Mar ’09, 2.23pm MDT PST on flickr You have to love random stuff. The Movie Plot Cookie Cutter Generator may be just the ticket you need to spring that creative idea that will see you polishing your acceptance speech and red carpet strut. […]
- 2008
- Late Uber Mega SXSW Post It’s well over a week that my first experience attending SXSW Interactive ended, and a blog post is just wriggling out. I wavered, wafted, and decided on a different, lazy (lame) strategy… to just soak it all in and write something prophetic later. Well, this will likely fall short on most accounts. And this is […]
- 2007
- I’m not Being Bad Enough…. Leigh is…. but I am not… blocked in China. The Great Firewall of China is a site to test URLs if they are ones being censored by the Chinese government. I guess I am not being subversive enough. [The Aim] of this website is to be a watchdog and keep track of which and how […]
and the default value, the link at the end is invisible.
On Michael’s site he might use There are 10 posts previously published on March 18th
- 2012
- Reading “Rear Window” A few weeks ago Jim Groom and I watched Rear Window, a classic film on many levels- you cannot go wrong with picking a Hitchcock film to analyze. I hardly consider myself a film critic, and what I write below comes from my own perspective, not having read any reviews or Wikipedia entries. The goal […] ➡
- Doing Your Self Out of What You Say You Can’t Do: 0 to Radio Show in 2 weeks In which I open a blog post with the worst grammatical title of the… wek? cc licensed ( BY ) flickr photo shared by stevendepolo In the ds106 classes here at UMW, we’ve just moved past week 8, and one of the grueling stretches for students in their projects to produce 30 minutes of an […] ➡
- Bryan Alexander Paints Four Futures for Education cc licensed ( BY ) flickr photo shared by cogdogblog This guy not only sees far, but makes it understandable for us- not simplified, but approachable. What a treat in my first week of work at the University of Mary Washington to have Bryan Alexander come for a 2 day visit. He might be the […] ➡
- Daily Create Recaps (though March 18) So much going on lately, so little blogged, time to re-train this blog dog. The activity on the Daily Creates seems to have dovetailed a bit, likely as other people are hitting this same stretch. Yet, I want to practice what I say in that while the challenge is daily, there is zero reason to […] ➡
- 2011
- This Arizonan Life THIS WEEK ARIZONA TRUTHS BROADCAST MAR 18, 2011 We look for the truth in Arizona, starting with the real age of the earth, as well as the headless bodies in the desert, legislators on ice, and something truly amazing buried in an old mine shaft. Where is the truth? We find it. —————————————————– This was […] ➡
- Road Rambles cc licensed ( BY NC ) flickr photo shared by sendarko I have been deeply touched by the (most ever at CDB) comments to my Into the Great Wide Open post as well as the #roadsongs shared on ds106 radio yesterday, masterfully conducted by the dog’s favorite bava. Late last night (after midnight here on […] ➡
- 2010
- Chrome Dog (króm hundur) cc licensed flickr photo shared by mrphancy I’ve been a few weeks into using Google Chrome, and sorry Old Fox, the shiny metal is looking and feeling good. With Firefox, it was a long running period of spending time I’d rather be browsing waiting for Mac Beachballs to stop spinning, or that pause when a […] ➡
- 2009
- Look for me at Sundance My Next Blockbuster from the Movie Plot Generator by cogdogblog posted 18 Mar ’09, 2.23pm MDT PST on flickr You have to love random stuff. The Movie Plot Cookie Cutter Generator may be just the ticket you need to spring that creative idea that will see you polishing your acceptance speech and red carpet strut. […] ➡
- 2008
- Late Uber Mega SXSW Post It’s well over a week that my first experience attending SXSW Interactive ended, and a blog post is just wriggling out. I wavered, wafted, and decided on a different, lazy (lame) strategy… to just soak it all in and write something prophetic later. Well, this will likely fall short on most accounts. And this is […] ➡
- 2007
- I’m not Being Bad Enough…. Leigh is…. but I am not… blocked in China. The Great Firewall of China is a site to test URLs if they are ones being censored by the Chinese government. I guess I am not being subversive enough. [The Aim] of this website is to be a watchdog and keep track of which and how […] ➡
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.