Currently reading: The Shining by Stephen King

Remove hashed placeholders when debugging WordPress SQL statements

Sometimes some search or meta query you're trying to do refuses to cooperate and and return results. If you thus find yourself poking around WP_Query's request property, which is a copy of the SQL statement executed to create your query object, you may have noticed some odd and space-inefficient syntax when using the LIKE operator.

Keep on readin' on Remove hashed placeholders when debugging WordPress SQL statements

Make VS Code slot a new file in the current directory

This isn't the default behavior for whatever reason, and it's something I've just silently dealt with for years. Because of this default functionality, instead of using [keys Cmd-N] I've always used the GUI buttons for creating new files while working on some project. I didn't think an alternative existed, but I've finally found that one does.

Keep on readin' on Make VS Code slot a new file in the current directory

Boolean arithmetic is pretty neat

Let's say you've got to position some element at the top of a page but that its top property will have to vary depending on the existence a couple other items that might also be up there. For instance, you want to position: sticky a menu bar but you have to contend with the possible presence of an announcement banner as well as the WP admin bar.

Keep on readin' on Boolean arithmetic is pretty neat

Published
Categorized as Code Tagged ,

Be wary when footer debugging

I know you're not "supposed" to debug things by outputting them into or past the footer of a site, but sometimes you just need to check on something real quick, like the ID or some other bit of data about a post, and you don't feel like dealing with any proper debugging tools. The wp_footer hook then gets used and the results don't make sense. What happened?

Keep on readin' on Be wary when footer debugging

Add domain name to every site's root class list

As a purveyor of userstyles, I found myself wanting to change a tiny thing here or there on various sites without giving them each their own tiny stylesheet. I also didn't want to start adding random selectors to a global stylesheet and identifying them by comment; I wanted to identify sites by their domain, e.g. html.apnews-com and keep all styles for that site nested underneath. In order to do this, I think a userscript needs to be involved.

Keep on readin' on Add domain name to every site's root class list