How to really exclude the home page in the WordPress wp_page_menu() function

I’m posting this little tip for my future self as much as for anyone else.

The problem: It seems that in recent years WordPress has all-but-deprecated the wp_page_menu() function in favor of the wp_nav_menu() function, but the latter is primarily intended for Custom Menus, and there are some cases where Custom Menus aren’t what you want.

I’m working on a couple of sites right now that have a lot of pages, and I don’t want their editors to have to go over to Appearance > Menus every time they add or move a page. I’m relying on the CMS Tree Page View plugin on these sites to allow the clients to leverage the built in Parent / Order settings on pages to manage their primary navigation, rather than managing a separate Custom Menu.

Since I’m not using a Custom Menu, I don’t want to use wp_nav_menu() at all; I pretty much have to use wp_page_menu(). Which is fine. Except for the fact that the site designs do not call for having Home in the navigation.

No problem, right? After all, I can just add 'show_home' => false to the arguments passed to the function, and it will remove the home page.

But it doesn’t.

I’m not entirely sure what’s going on in the WordPress core here, but I suspect that show_home only works if you’re using the old school default configuration of WordPress that calls for the home page being the main “posts” page. And who does that anymore? If you’ve created a custom home page, even if you’ve configured WordPress properly to display it as the main page, this function doesn’t care. (Do functions “care” about anything? But I digress…)

Remember also that there’s an exclude argument, to which you can pass a comma-delimited string of post IDs to exclude. That works, but… ugh. You mean I really have to hardcode the post ID of the home page right into my header.php file?

Of course not. Use this: get_option('page_on_front') and it will automatically find the home page. This is great if you want to be able to reuse a theme or custom function on multiple sites or just not commit the transgression of hardcoding something that really doesn’t need to be hardcoded.

Here’s the complete code sample. Note there’s no need to bother with show_home at all.

wp_page_menu(array(
    'exclude' => get_option('page_on_front'),
));

Edge of what?

Let’s talk about Internet Explorer for a minute. Approaching two decades into a career as a web developer — cripes! how is that even possible? — I have spent a big chunk of my life hating Internet Explorer.

There was a time when I didn’t hate it. For several years, Internet Explorer was the best web browser for the Mac. (Yes, really!) But right around the time Apple released Safari and Microsoft decided to pull the plug on the Mac version of IE, everything started to go sour.

In the early 2000s, when Windows XP was released, and Internet Explorer 6 along with it, Microsoft dominated the tech world. Especially the business tech world. And with the web standards movement in its infancy, Microsoft could pretty much do whatever they wanted with the browser. Internet Explorer 5, 5.5 and 6 each introduced new, Microsoft-only technologies (VBScript, ActiveX, .NET, etc.) that became deeply entrenched in the business world, where countless corporate developers created indispensable internal web applications that were not only dependent on Internet Explorer, but specifically on quirks of version 6 (or 7) of IE. It’s a big reason why there are still office computers running Windows XP and IE 6 or 7. Because even as bad as IE 8 is, it was the beginning of Microsoft’s acknowledgment of the changing times and reluctant move towards web standards.

Long story short, I don’t just hate IE because it’s from Microsoft, or because it’s fun to bash on. Contrary to the impression I sometimes give, I don’t hate Microsoft, and as much as I love to crank, I’d prefer a world where I didn’t have things to crank about. I hate Internet Explorer because it has made my job harder, for most of the time that I’ve been doing this work.

So, it probably goes without saying that I took the announcement of the death of Internet Explorer as good news. Of course, Microsoft has to make its own browser. Uh… just… ‘cuz. Of course. So with IE going away, Microsoft has announced “Edge”, their new browser.

Meet the new browser, same as the old browser

This morning Brand New posted the new logo/icon for Edge. At least, I think it’s a new logo. For a new browser.

edge
Source: Brand New

What is this? No, seriously. What. Is. This.

This logo fails for me on several levels. First, and most obviously, it evokes Internet Explorer. Why would Microsoft want to do that? They’re killing IE for good reason. Why create an immediate association between it and their new browser?

I think this new logo fails both conceptually and in its execution. It’s just plain ugly. But more than that, the slice/swoosh thing doesn’t work. In the old logo, it was part of the “ring” around the “planet” that the perfect circle “e” represented. A bit hackneyed conceptually, but at least it was a consistent concept. But by using the “e” from Microsoft’s new humanist corporate font (I think) — which, taken on its own, is kind of an ugly shape anyway — I think, you lose the “planet” concept. And the rest of the ring outside of the “e” is gone too. So all you have left is this weird “e” with a slice missing, which makes absolutely no sense. The only explanation for the slice is as a deliberate evocation of the old Internet Explorer logo, which again it seems they should want to distance themselves from.

I like the new blue color. That’s about the only good thing it has going for it.

So far I have not tried the preview release of Microsoft Edge. Frankly, as a web developer, I am not enthusiastic about having to support another new browser, and I’m not confident that Microsoft is going to make a very good new browser, even though IE 9 through 11 were pretty decent. All I have to go by, at this point, is this logo. And what it tells me is that Edge is just a crappy knockoff of an already crappy browser. No thanks.

Postscript: I just noticed that exactly 6 years ago today I wrote a blog post that also discusses Internet Explorer. Even then — SIX YEARS AGO — IE 8 was out and I was already cranking about IE 6 as an old and outdated browser.

The Raspberry Pi Arcade Project: An Interlude

I’m currently at Part 8 of my Raspberry Pi Arcade project. That is, my own Raspberry Pi Arcade project is at the point of what I have planned as part 8 in the blog series. The blog series itself is stalled out after Part 3. And while the risk of getting too far ahead of myself is there — I don’t keep copious notes, so by the time I write a blog post my own project is so far removed from the topic of that post that I may forget key details — the real threat to the project is coming from what I’m experiencing around my own “Part 8”: polishing the user experience.

I’ve come to realize that while the Raspberry Pi is unequivocally an awesome piece of technology — a complete computer that fits in an Altoids tin, runs on a cellphone charger, plugs into your TV and costs less than $50 — it’s not a powerful computer.

Yes, I always knew it was not a powerful computer. And for a lot of applications it doesn’t need to be. But the main thing you gain by sacrificing that power is its diminutive size. It fits anywhere.

The thing is… for some applications you don’t need a computer to be tiny. And if there’s any application where you can afford for your computer to be huge, it’s a full-size arcade cabinet. I originally had visions of opening up my X-Arcade Tankstick and mounting the Raspberry Pi inside it. That would be cool — amazing, in fact — if I weren’t also mounting the Tankstick onto a full-size cabinet.

So… as I struggle with tweaking settings in my advmame.rc configuration file at the command line, trying to eke every last bit of processing power out of the Pi just so it can render simple early ’80s video games at full screen, I begin to wonder why, and whether or not it’s worth it.

Clearly my emulation dreams would be better served by powering my cabinet with a more robust PC. And the whole thing would probably be a lot easier to set up.

But as I stayed awake last night until well past 1 AM, sitting in front of my living room television, typing arcane commands on a black screen in that classic ’80s DOS font, I realized that this experience is part of what it’s all about. Not just having an arcade cabinet, but hardcore geeking out on Linux. Using a computer the way I used my first computer back in the 1980s.

As much as I’ve embraced the “it (usually) just works” ethos of iOS and modern mobile computing devices, app stores and touchscreens and nary a file system or command line in sight, sometimes I miss computing the old way, when it was a tinkerer’s hobby.

That’s what the Raspberry Pi Arcade project is really about. And maybe it will be the stepping stone to even more creative electronics projects with the Raspberry Pi as their brain. I could see, at some point in the future, replacing the Raspberry Pi in my arcade cabinet with a more powerful PC running Ubuntu Linux, and finding a new, even crazier project where the Pi would be right at home.

Forget red state/blue state: it’s really red browser/blue browser

Sean Tevis browser statsAnyone who’s read this blog for any period of time knows my political leanings pretty well. I’m about as liberal as they come in this country (which means I’m probably middle-of-the-road anywhere else). And the same reader(s) probably also know(s) how I feel about Internet Explorer 6.

Well it’s interesting to see that there seems to be a correlation between political viewpoint and web browser usage. As (almost) always, this comes from Daring Fireball. We’re looking at the decidedly non-traditional campaign blog of Kansas Democrat Sean Tevis. His campaign did a survey that, among other things, discovered that users of outdated browsers like Internet Explorer 6, AOL, “Don’t Know” and “No Internet” preferred, strongly, his Republican opponent, while users of Firefox, Chrome, Opera and Safari preferred Tevis. Interestingly, IE 7/8 users slightly favored Tevis.

It would be interesting to see the raw numbers, rather than just percent deviation, to get a sense of the relative proportions of the electorate who fell into each category, especially considering that Tevis apparently lost, by a small margin.

It’s also interesting to look at the strength of each group’s leanings. Those who most strongly favored the Republican candidate were the AOL users and non-Internet users, a.k.a. the Luddites. Chrome users (all on Windows) were the strongest Tevis supporters, followed by Safari (presumably all or nearly all Mac) users. Firefox users were slightly weaker supporters of Tevis. This makes sense to me in that I suspect there’s a high correlation between “average” Mac users (who almost all use Safari, just like most “average” Windows users run IE) and Democratic leanings, whereas users of Firefox (and of open source software in general) are as likely (or moreso) to be libertarian as liberal. Opera… well… I don’t know. Contrarians?

That IE 7/8 users slightly favored Tevis is most interesting to me. IE 7/8 represent by far the largest percentage of the Internet-using population. And the country as a whole moved slightly in the Democrats’ direction in the 2008 election. But Kansas is far more conservative than the US populace as a whole; combine that with the “No Internet” crowd, and a small margin of victory in favor of the Republican candidate makes sense.

P.S. Sean Tevis for President 2016.

Getting Ready for MGC

MGC, for those not in the know (including myself, not terribly long ago), is the Midwest Gaming Classic, a big event coming up in a couple weeks in Milwaukee where I will join throngs of like-minded geeks, many of whom are also, like me, regulars in the AtariAge Forums, to play old video games, talk about old video games, buy and trade old video games, and just basically live for a brief moment in a world where they are still relevant (a world outside of our own heads, that is).

Being a person who can still fire up a game of Yars’ Revenge pretty much whenever I feel like it, this is a welcome experience indeed. I am planning to take a few of the rarer but also less-interesting (to me personally) titles from my collection as trading fodder, and I’ll see what I come home with. I just wish Paul Slocum would’ve been able to have a finished version of his Homestar Runner-themed Atari 2600 RPG homebrew ready in time for it.