Highlight a WordPress Admin Active Submenu

If you’re working on a theme or a plugin for WordPress and you want to highlight an active submenu item, then your implementation is going to vary based on where you want to highlight the actual item.

Active Submenu Items
An overexaggerated menu to help drive this point home.

This is one of those times where it’s helpful to have clear terminology for what you’re trying to modify:

  • Are you working on trying to highlight an active submenu in the admin menu,
  • Or are you working to highlight an active submenu on the front-end of the theme?

There’s no consistent way to do this. For what it’s worth, I don’t think they should be as they are two completely different entities (for lack of a better term). Perhaps having some semi-consistent filter names would be nice, but that’s about it.

Regardless, when you set out to highlight an active submenu item, it’s important to note which part of the project you’re working on and then go from there.

Continue reading “Highlight a WordPress Admin Active Submenu”

Syncing Atom Settings Between Computers

Syncing Atom settings between multiple machines is useful in that you’re able to maintain all of your packages, settings, and so on regardless of the machine you’re on.

And yes, I’ve been talking about Atom a bit more as of late. I’m clearly a fan. But that’s evident, right?

If you maintain more than one machine, then it’s usually nice to have the same development environment configured between the two of them.

Here’s a method for syncing Atom’s settings between though it does assume you use Dropbox. If not, any service you use for sharing files can be used, but your actual steps will vary.

Continue reading “Syncing Atom Settings Between Computers”

Digest For February 28, 2016

I typically don’t post on Saturdays, and I usually let those who have signed up to receive emails via Postmatic get their summary via email once a week.

Time

But not everyone reads blogs the same way, and not everyone subscribes via email, so I thought I’d try something new. That is, this is an experiment (and I invite your critique at the end of the post).

With that said, here is a summary of the posts from this week.

Continue reading “Digest For February 28, 2016”

Detecting Copy and Paste in JavaScript

Detecting copy and paste in JavaScript is not something that’s new to web development. How you do it may vary, though, depending on the set of tools you’re using.

Cut and Paste in JavaScript
Cut and paste, not cut and tape. And not like this.

Given I focus primarily on WordPress, the majority of the JavaScript I write uses jQuery. And though there are a number of ways you can go about doing this (which I’ll talk about later), some of them are deprecated (though they still work).

Anyway, so I was specifically looking for a way to handle the case where a user pastes content into a field using keyboard shortcuts.

Continue reading “Detecting Copy and Paste in JavaScript”

Loading WordPress Tries to Download a File

Over the past few weeks, I’ve had a few clients contact me saying that their website won’t load. Instead, their current installation of WordPress tries to download a file whenever they access their site.

This doesn’t matter if you try to access wp-login.php, /wp-admin, or any of the usual directories. Further, if you look at the permissions on each of the files, everything looks in order.

WordPress File Permission Scheme

On top of that, there are no suspicious (read: malicious) files in place that would be redirecting a user’s request or anything like that.

So what gives?

Continue reading “Loading WordPress Tries to Download a File”