In WordPress, hide page name for protected pages

WordPress has a handy feature where you can password protect pages on your site. When a user lands on that page they are shown only the page name (preceded by “Protected”) and a form to enter a password.

On a recent project, I also wanted to hide the page name since that was also sensitive, along with the content of the page.

The fix is pretty easy, and uses the post_password_required() function.

Simply drop the following code into the functions.php file of your theme:

add_filter('protected_title_format', 'protected_title_function');

function protected_title_function($title) {

  if ( post_password_required() ) {
    $return_val = __('Protected', 'themedomain');
  } else {
    $return_val = '%s';
  return $return_val;

Don’t forget to also change the permalink since it is generally based on the text of the title.

My 2015 goals

I’ve never subscribed much to New Year’s resolutions. January commitments always seem destined for March guilt. But, if there’s anything my first year at Amazon has taught me, it is the power of setting goals and sticking to them. So, what the hell.

If there’s one thing I’ve missed the past few years, it is building web sites, from design to code. I miss this work too much to let my skills atrophy, so in 2015 I’m going to get back into the business. My work at Amazon is teaching me program management and metrics, which I hope will be an ideal match with my renewed technical skills.

Launch is a new website I’m developing and plan to launch in February. On this site I will break down the design and code of interesting and clever, but also — importantly — useful, features from websites that I come across. PeekCode will be my place to experiment with marketing, advertising, and building up a subscriber base. By the end of 2015, my goal is to have 500+ subscribers and have earned $1000+ in advertising revenue.

Earn a new computer

My current computer, a 2009 MacBook Pro, has been a solid workhorse for the past 5 years. A battery replacement and new SSD in 2014 gave it a new lease on life, but it is seriously showing its age. I don’t want to just replace it though, I want to earn a new one through web work (freelancing, selling WordPress themes or graphics). While I expect a new computer to cost about $2500, my goal is to earn a $5000+ in freelance revenue.

Learn JavaScript, properly

I’ve always been good at hacking my way through actual code. I can pretty easily break things until they work, Google my way through projects, and blindly stumble my way to a functional product. But I’ve never been able to sit down, map out a set of functionality, and code it through without referencing every second function. In 2015, that will end. My wonderful wife gave me JavaScript: The Definitive Guide, and I’m going to walk the fundamentals before I run (for once).


Being a city-boy, I’ve managed to go my entire life without needing a license. I’ve been told that makes me a good European, but a poor American. Shudder. That will end in 2015.

And that’s it. We’ll see how I’m doing in 2016.

Review of The Maltese Falcon: The Quintessential Film Noir; In Book Form

Nowadays, pretty much any major movie hitting theaters comes with a novelization. Typically these are shot-for-shot, line-for-line remakes spread over a few hundred pages. They’re probably for those that think the book is always better than the movie, and a nice way to earn a little extra dough from existing properties.

If you’ve seen the movie, The Maltese Falcon by Dashiell Hammett comes across as one of these books. While it preceded the Humphrey Bogart movie by 11 years, if you’ve seen the film you’ve read the book, well, nearly so. This is, by no means, a bad thing. The movie is first-rate, the pinnacle of the film-noir detective story – hard-bitten detective, damsel in distress, mysterious foreigner, and promise of riches bought at the cost of your life – it’s all here. The movie is nearly a complete recreation of Hammett’s book, making it difficult to review the one without touching on the other. So I won’t try.

[quote position=”right”]“Samuel Spade’s jaw was long and bony, his chin a jutting v under the more flexible v of his mouth. His yellow-grey eyes were horizontal. He looked rather pleasantly like a blond satan.”[/quote]

The book itself is very visual. Characters are drawn rather than expressed. Sam Spade, the smooth, calm detective at the center of the novel, is made of evocative Vs, the V of his shoulders and upper body, and particularly his cold, V-shaped smile. Hammett evocatively describes Spade as “rather pleasantly like a blond Satan.” Heck, one of the main villain’s, a rotund man of genial humor is named “Mr. Gutman”.

As you’ve guessed, this is not a subtle book. Actions are clearly defined. If a character’s motives are not, you can be sure, at the least, they’re no good. The story isn’t complex and surprises are few. Emotions are shown rather than felt: a trembling hand, a guttural swear, and, most often, a cold stare.

The book moves swiftly and the mystery easily excites attention. Honestly, if there is one failing of either, it’s that the film is not even more faithful to its source. Sam Spade in the novel is similarly smooth to Bogart’s depiction, but he’s also harsher and almost cruelly detached. The setting of the book is darker, smokier, and more sinister. Everything, and everyone, gets tied up into ominous knots. In Spade’s office, early in the book, “ashes on the desk twitched and crawled in the current.”

A general sense of malevolence permeates the pages. Without spilling the beans, the book sets up Spade’s actions in the end much better. The movie ends with everything neatly tied up, the sharp detective seeing justice is done. The book ends on a darker note. One of the last times we hear of Sam Spade: “His voice was not loud. It was bitter. Sam went out and slammed the door.”

Review of Cat Sense: Deconstructing the modern cat; with only partial success

I’m a cat owner. My little Sasha is a bundle of fur, energy, and perplexing behaviour. Cat Sense, which promised to unravel my feline friend, peaked my interest. Written by an anthrozoologist, John Bradshaw, the book covers the past, present, and possible future of the common feline. It’s a compelling read, and worth the time of the considerate cat owner, though it isn’t perfect.

The book is structured in roughly three sections: past, present, and future.

The Past

The history section is an entertaining read. In the ancient world, cats were revered as personifications of the gods, inspiring religious cults from Greece to Egypt. In the Middle Ages, they were viewed as the devil incarnate and actively persecuted. Many believe that killing cats probably helped spread the black plague since rodents, prime carriers of the disease, could reproduce unchecked. Bradshaw notes this is probably true, though likely exaggerated.

The evolutionary side is less interesting, partly because the  genetic lineage is quite muddled but also because the narrative meanders too much.

The Present

[quote position=”right” cite=”John Bradshaw, Cat Sense”]”The meow is usually directed at people… Cats need to meow because we humans are generally so unobservant.”[/quote]

The second part, looking at the present-day cat, explores everything from cat physiology, early feline development, to how cats manage manage relations with humans and other cats. It even explores the question: “Do cats have feelings?” (They do, probably.) Bradshaw supports many of these sections with his own personal cat experience, which adds levity but helps cloak one nagging issue with this book. Despite the subtitle, “The New Feline Science”, there doesn’t seem to be much depth to feline science. While the book seeks to explain many common feline behaviors with the latest research, this is often one or two studies with tiny sample-sizes. Bradshaw routinely notes there’s just not enough evidence to reach solid conclusions. While the transparency is commendable, it makes it harder to become “…a Better Friend to Your Pet” as the subtitle concludes.

Playing for cats still closely mimics hunting, unlike dogs, which have abstracted play far from the original intent.
Playing for cats still closely mimics hunting, unlike dogs, which have abstracted play far from the original intent.

This section could also be better organized. Many earlier chapters cover similar ground, so the same points are often reiterated. Nonetheless, there is some interesting content here. Particularly compelling is how significant the first few weeks of kitten-hood are on the personality and habits of a cat. Delaying human interaction with a kitten by only a few weeks can make it much less friendly toward humans for the rest of its life. Bradshaw also provides an intriguing and balanced summary of the controversial impact non-native cats have on local wildlife.

The Future

Due to breeding preferences, the future may be cloudy for our furry little friends.
Due to breeding preferences, the future may be cloudy for our furry little friends.

Lastly, Bradshaw looks into the crystal ball of human behavior and cat genetics to get a sense of where the common feline is heading. Unlike dogs, which evolved over thousands of years in close quarters with humans, cats are a recent addition to human households. As such, they’ve had less time to develop the emotional and behavioral cues that make dogs such exceptional pets. And cats may not get the chance. Bradshaw notes widespread spaying and neutering means feral cats are more likely to reproduce, selecting against traits ideal for domestication. Furthermore, human-managed breeding is often done for appearance rather than behavior. Without more pressure to select domestic-friendly traits, Bradshaw sees a cloudy future for the domestic cat.

Despite the deficiencies, if you’d like to get a better sense of where your cat is coming from, Cat Sense is worthwhile read. It may not be the manual decoding your cat’s behavior the subtitle suggests, but it will give you a better understanding of where your cat came from, and where its brethren are likely heading. Hopefully more researchers will take up the study of our inscrutable feline friends, filling in the many gaps in our understanding that Bradshaw brings to light.