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 PeekCode.com

PeekCode.com 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).

Drive

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.”