Limit to One Post on WordPress Front Page

Let’s say you have a WordPress blog. You only want one post to appear on the front page of that blog. But, you want all other pages (e.g., the second page, category pages, monthly archives, etc.) to display more than one (be it 5, 10, or whatever you chose on your “Reading Settings” page). The first part is easy, the latter has a few pitfalls to be aware of.

First, we’re going to call query_posts to modify the query a bit. We only want this on the home page, so we wrap it in an if statement:

global $wp_query;
if ( is_home() && !is_paged() ) {
  query_posts(
    array_merge(
      $wp_query->query,
      array('posts_per_page'=>1)
    )
  );
}

is_home() will be TRUE if you’re on the main blog page; !is_paged() verifies that we’re on the first page (because is_home() is still TRUE on subsequent pages (e.g.http://example.com/page/2/)).
Continue reading

Custom Permalinks for Custom Post Types in WordPress 3.0+

I’ve been playing around with WordPress 3.0 to create a bug/issue-tracking plugin (i.e., using WP to track bugs, not to track WP bugs (although it could conceivably do that)). More details about the plugin will be forthcoming, but now is as good a time as any to share the solution to one problem I came across.

Creating New Post Types and Taxonomies

When you create a new post type, you use the register_post_type function. When you create a new post type through that function, WP creates a new rewrite rule base on the name you give the post type. In my case, I’ve created an issue post type, so all issues, by default, will have the permalink /issue/%issue%/ (where %issue% is replaced with the post slug). Using the rewrite argument to register_post_type, you can change the beginning of the permalink to something different (e.g., /bugs/%issue%/) should you so desire.
Continue reading

Comcast Is Up to Its Lying Ways Again

Like everyone else, I’m fed up with Comcast again. In the latest insult, my bill has gone up 35% without notice, and the CSR tells me I’m stupid for not anticipating it.

Here’s a letter I received last fall:

A reasonable person would read that letter to say that my rate is changing to $42.95. And it did, for the next six months. But today, my bill said I owed $57.95. I think I’m not alone in recognizing that $42.95 and $57.95 are not the same number.

So I called Comcast. Amy, one of the most unhelpful CSRs I’ve ever spoken with, insisted over and over that I had signed up with a promotional rate in November, that the promotion was now ending, and that Comcast had been clear and upfront about the price all along.

Well, Amy, you’re wrong. That letter clearly states “we will be reducing your price to $42.95 per month”. Amy tells me that I’m an idiot. The letter didn’t explicitly state that this was a permanent rate, so I should have known that it was a temporary, 6-month promotion (Amy, apparently, has incredible psychic powers not available to mere mortals like me). And I should be happy, anyway, because $57.95 is a great, competitive rate for the service I’m getting.

Thanks for lying to me Comcast. Thanks for insulting me. And thanks for buying out a company with better CSRs and replacing them with Amy.

Anyone at Comcast want to fix this?

No SVN on BlueHost

Nevermind.

SVN stopped working on BlueHost last week. After a bit of digging, I discovered that the configuration of OpenSSH had changed, limiting the $PATH for non-interactive shells to the default of /usr/bin:/bin. You can’t change it in ~/.bashrc; you can’t change it in ~/.ssh/rc.

So, I start talking to tech support. At first, they tried to be helpful, and apologized for the inconvenience. But today, I got this message:

“Openssh was upgraded for security reasons. Unfortunately the upgrade changed functionality and now some programs such as subversion and git no longer work the way they did previously.

“It appears that the old behavior may have been flawed in the first place and shouldn’t have worked. We are looking into how to restore previous functionality without any negative security impact, but we have a desire to keep our accounts and servers from being compromised and therefor any decisions on changing functionality will be made with that in mind, but for the time being we are not promising that the original functionality will be restored due to security reasons.”

Well, that’s that, then. Goodbye, BlueHost. You are no longer an adequate web host. I think I’ll give 1&1 another shot before I finally give in and go with Linode.

Update 2010-04-22: See Franklin Strube’s post below for a possible workaround. I haven’t tested his solution (I’ve already moved off of BlueHost), but it seems sound. Thank you, Mr. Strube.

Wish List: Mobile Clipboard Sharing

A feature I’d like to have on my Droid (or any smart phone, or computer in general): a shared clipboard. I’d like to be able to copy a link, or text, or whatever it is I’m copying on my desktop, and paste it on my phone, and vice versa.

How might this work?

  1. I copy something on my desktop
  2. I click on an icon that will send the contents of my clipboard to a web service
  3. Said web service notifies my phone that it has new content (or my phone polls regularly for new content; I’m not sure how that might work)
  4. My phone grabs the new content and saves it to its local clipboard
  5. I paste the content in a appropriate location on my phone

It doesn’t seem horribly complicated at first glance. Is there anything out there that does this?