Weekly Web Harvest for 2022-07-31

School districts facing ‘crisis’ teaching shortage – The Washington Post Turns out novelty pencils, some gift cards, and supportive social media posts don’t make up for all of the huge problems. xkcd: Deepfakes One Foot Tsunami: An Embarrassment of Riches The contract specifically reads: “Player shall not receive any credit for Independent Study with respect to any time periods during which any material is displayed or played on an iPad or electronic device if (a) Player is not personally studying or watching the material while it is being displayed or played or (b) Player is engaged in any other activity that may distract his attention (for example, watching television, playing video games or browsing the internet) while such material is being displayed or played,” per Rapoport. Paul Fairie on Twitter: “Whenever I’m tempted to think that a new thing seems too complicated, I read newspaper articles about pizza from the early 1950s. https://t.co/0qqfngmDWz” / Twitter I taught people how to use trackpads back in the day. The Visual Science Lab / Kirk: When I wrote about mirrorless cameras with EVFs back in 2010…… The follow up? They’ve actually stopped buying used DSLRs  because — no one seems to want them anymore. They don’t actually sell these days. But Sony A7s, Panasonic GH cameras and Olympus OM-1s, even Leicas, are flying off […]


Filtering Front-End Titles

As part of the ongoing saga of duplicating content, we need a way to see that a particular post is a duplicate and living in a particular module. The easiest way to do that is to add something in the title. Organically, the authors started adding it like Item Title (Module). Now we don’t want that showing up on the front end for users. Now we could just edit that manually when it’s added to the menu but that sucks and it’s another thing to teach people to do and then make sure that they do. That’s bad. Technology can deal with stuff like this and it should. This is another example of filtering content. The content exists and we just need to chop off the portion in the parenthesis and we need to do it only on the front end. To make sure it only happens on the front end, we can use is_admin. This is handy function and removing the ! mark would apply the same filter only to the backend. Then with regular old PHP, we can use strpos to find the first parenthesis and substr to chop the string at that point.


Filtering the Post Link

There have been a number of occasions when I’ve wanted to write posts but have them link to another site rather than the post on the WordPress site. It happened most recently with media coverage for a research project. It didn’t seem worth building a whole custom post type for the media coverage. Instead I was adding using Advanced Custom Fields to add a field for an external URL when the post was put in the News category. Initially, I built the post creation to look and see if that field had content then use it instead of the permalink. It looked something like this. It was fine. A bit messy but fine. One way if failed was in the “read more” links which still had the original permalink. Now I could have built out a custom read more link but that seemed needlessly complex. Instead, I looked a round a bit for a WP filter to use on the permalink and found post_link. That enabled me to do the following. Nice and easy and it applies to the read more links too.


Semi-fixed bottom navigation

This is another solution for the social science research site. Each fix seems to spawn a new minor, yet complex, problem. It’s easy to see how some web site costs get out of control. Hopefully this one will be the end of things. In our previous episode, we made a fixed bottom navigation to standardize things and to avoid some other problems detailed in the previous post. I’d dealt with the footer overlap just by adding some padding so it’d end up above the navigation. Admittedly, that was kind of a sloppy solution. So now, this solution looks at the footer. It figures out how tall it is. Then it looks at where you’ve scrolled to. When you get to a certain spot, it’ll move the fixed navigation upward to keep the footer at the very bottom. When you scroll back up, it’ll put it back at the very bottom. It’s javascript with a bit of css transition to make it smoother. See the Pen footer spy fixed by Tom (@twwoodward) on CodePen. Aside There is a larger consideration I need to figure out for Middlebury projects. In the pay-by-the-hour world, it’s much easier to paint cost/benefit options for additional features or changes of various kinds. It’s easy to say. Sure. We can do that. It’ll cost this much. Worth […]