HOLIDAY WORDPRESS DEAL: 30 Minute WordPress Consultation

As the holidays kick into full gear, and people start looking at a short sprint to gift times with family, I am offering a 30 minute phone consultation related to WordPress for $100. This is a great thing for someone who needs to figure out how to do something that may be unfamiliar for them or if they are just getting setup with WordPress and need plugin recommendations, or the like.

To setup your 30 minute appointment or to inquire about gifting that appointment, fill out this form. For the description, just reference this deal.

For longer term commitments or consulting engagements, including custom plugin development, I am booking clients for Dec and Jan, so feel free to ask about those opportunities as well.

This offer is only good today, Friday Nov 23, 2012 until midnight Central Time.

This offer is good through Midnight, Monday, November 26, 2012 – Cyber Monday.

Read More

rewrites

TUTORIAL: Building Custom Rewrite Endpoints in WordPress

Recently I concluded a sizable project that involved deep integration with an external API. I was responsible for creating content pages based outside of WordPress. To be clear, the pages would use an internal WP template, but all the content was generated using this external API.

In order to make this work within the WordPress Rewrite system and serve pages that WordPress knew how to handle in a non-traditional way, I had to tackle this in a multi-prong way: using the template_redirect as well as the built in Rewrite API.

Note: I’m not giving away the full sauce here as the project is non-open source. As well, I’ll be abstracting some stuff a bit. If you’re smart, you can fill in all the blanks regarding how to fully implement this.

First we need a base class:

1
2
3
4
5
6
7
8
9
10
11
12
13
<?php

class Base_Class {

  public function __construct() {
    $this->hooks();
  }

  public function hooks() {
  }
}

new Base_Class;

This is the base of pretty much every class I write as part of a plugin in WordPress. If you don’t follow Object Oriented coding practices, start now.

The next step is to register some variables with WordPress. Because WordPress is using the template_redirect hook to get the proper template files, you will often lose necessary query string variables, and you definitely can’t use them in an endpoint (i.e. /foo/bar) without WordPress knowing about them.

So let’s register them using the query_vars filter.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
<?php
class Base_Class {

  public function __construct() {
    $this->hooks();
  }

  public function hooks() {
    add_filter( 'query_vars', array( $this, 'query_vars' ) );
  }

  public function query_vars( $qv )
  {
    $qv[] = 'foo';
    $qv[] = 'bar';
    return $qv;
  }
}

new Base_Class;

After this, we want to actually create some rewrite endpoints. In this example, I want to allow permalinks like /foo/content-slug/ and /bar/content-slug. With the following code that adds a rewrites() method to the class, and hooks on the generate_rewrite_rules filter, we can create these two endpoints. In our imaginary template, we would use get_query_var() function to handle logic for display purposes, but that’s outside of this article scope.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
class Base_Class {

  public function __construct() {
    $this->hooks();
  }

  public function hooks() {
    add_filter( 'query_vars', array( $this, 'query_vars' ) );
    add_filter( 'generate_rewrite_rules', array( $this, 'rewrites' ) );
  }

  public function query_vars( $qv )
  {
    $qv[] = 'foo';
    $qv[] = 'bar';
    return $qv;
  }

  public function rewrites( $rules )
  {
    global $wp_rewrite;

    $new_rules = array(
        'foo/([a-z]+)/?$' => 'index.php?pagename=wppage-holder&foo=' . $wp_rewrite->preg_index(1),
        'bar/([a-z]+)/?$' => 'index.php?pagename=wppage-holder&bar=' . $wp_rewrite->preg_index(1),
    );
   
    $wp_rewrite->rules = $new_rules + $wp_rewrite->rules;
    return $wp_rewrite->rules;
  }
}

new Base_Class;

Specifically, note the new rewrite rules and how they are structured. If those permalink structures identified above match these new rules, then we will pass the request on and use the template file designated for a page (that you do have to create in WordPress, by the way) with the slug ‘wppage-holder’. This can be done by designating a template file on the page edit screen or by naming the template as page-wppage-holder.php in your theme – again, outside the scope of this article.

If the permalink matches foo, we pass the foo variable on. If it matches bar, we pass the bar variable on. Logic on the other end left to you.

This is where I have to stop using this example, for client confidentiality purposes, but imagine what is possible now if you extend this and use the template_redirect hook to handle some custom redirects leveraging wp_redirect()?

Imagine. :)

Read More

WordCamp SF_6100572433_l

Competing Interests: WordCamp SF and the WordPress Foundation

WordCamp SF
Photo used under Creative Commons and taken by Niall Kennedy.

Six years ago, the first WordCamp ever was held in SF and it became the launching point for many local regions and cities to continue the conversation, learning and educating around WordPress. It was always meant to be a hyper-local thing. Actually, as a correction, it was never meant to be a thing at all. It was meant to be a get-together of SF WordPress people.

But surprise, it caught the attention of WP developers, users and designers worldwide (including myself), and we came in by storm!

The following year, the decision was made that, due to such high demand in SF, and to try to encourage WordPress user groups in other cities, WordCamps should be distributed and locally organized. That kicked off a slew of WordCamps that (seemingly) doubles every year. I organized WordCamp Mid-Atlantic (the roots for WordCamp Baltimore and WordCamp DC today) back in 2009 and 2010.

Personally, I’ve been at or spoken at dozens of WordCamps (Mark your calendars… if you’re in Las Vegas on October 6, I’ll be speaking there too). To name a few, I’ve been to WordCamps in SF, San Diego, Las Vegas, Raleigh, Baltimore, Miami, Atlanta, Dallas, Houston, and New York to name a few. I’ve been to San Francisco every year except one, and that was due to another travel conflict.

I’ve been an organizer, speaker, sponsor and attendee.

In other words, I am no rookie and I am in good standing in the community!

The WordPress Foundation

A few years ago, after some financial mis-management for a large WordCamp, the WordPress Foundation was setup. The Foundation was designed to promote the use of WordPress, protect trademarks of WordPress and related WordPress trademarks, including WordCamp. As part of this responsibility, the Foundation has issued rules around WordCamps via WordCamp Central. Today, I could not run WordCamp Mid-Atlantic the way I did before as the rules are quite rigid. On the other hand, I would also not have taken a nearly $3k personal loss on Mid-Atlantic in 2010, so the rules, in my opinion, aren’t all bad.

A sampling of these rules include that any WordPress-based commercial sponsors who distribute code must distribute 100% GPLv2 compliant software and having organizers approved. Also, all sponsorship money goes through the Foundation at this point.

WordCamp SF

Which leads me to a problem I feel the need to weigh in on. WordCamp San Francisco is no WordCamp. It is a conference in every rightful way of the word, as it should be. And it should be renamed as the WordPress Conference or something other that WordCamp. WordCamp SF is commanding massive sponsorship levels, of which one sponsor is gladly paying a whopping $30,000 for “California Street” level sponsorship.

Other sponsorship levels are at $10k, $7500, $5k and $2k.

This is against an unstated, yet enforced, Foundation policy surrounding limits for sponsorships. These rules were put in effect to encourage big companies, like Dreamhost who is in for $30k at WCSF, to spread the wealth among a variety of WordCamps instead of just one. The idea is that if, say Microsoft, was well-connected to an organizer of one WordCamp, the Foundation has mechanisms in place to move funds around to other less-connected, but still necessary, WordCamps. It also ensures that WordCamps don’t put their eggs in one basket and then have a major sponsor flake and leave them holding the bag. Fine, I can get behind that rule.

WordCamps also have rules about content. It used to be that every WordCamp had some session on using social media. While that is perhaps important to WordPress users, it’s not WordPress! So sessions need to be WordPress related. I totally get that and have no gripe with that provision. For the first WordCamp Mid-Atlantic, I invited Anil Dash to keynote, knowing that at the time, Anil was an SVP and Founder of a WordPress competitor. But it was open source and I felt that the competition only made us as a WordPress community stronger. I expected push-back from inviting Anil, and if the rules were in place then… he may not have been able to Keynote.

We know WordCamp SF is Matt’s baby and he chooses content, not based on whether if it’s WordPress-related, but whether it’s inspired him. At least that was true until last year when Jane Wells organized.

We also know food, photography and Jay Z inspire Matt, but I don’t think Rachael Ray would be a speaker at WordCamp SF… though perhaps I wouldn’t be surprised if she did end up speaking there. I digress.

Matt Mullenweg, who is both the President of Automattic, the commercial arm of WordPress, and the President of the WordPress Foundation responded to my request for comment by admitting that some content in the past has drifted from WordPress but that he still stands by them. “None of those speakers normally speak at WordCamps, but we’re able to attract them and orient them to contributing something interesting to the WordPress community because of WCSF’s location and prominence.”

I suppose, again, Rachael Ray could speak and discuss the merits of using WordPress for a food blog.

Related, ticket prices are kept artificially low, but sponsorship levels are extremely high. It feels wrong.

The Foundation does suggest lower ticket prices (around $20 is typical), but one wonders why WordCamp San Francisco could not charge a reasonably low rate of $200 for an attendee ticket, given that people would still come from all over the world to attend. This would also lower sponsor levels and cause less controversy. DrupalCon is charging $400-$450. RailsConf is approximately $800. Why does the official WordPress conference have to sell at $20 when sponsorship levels feel inappropriate?

;

The Foundation Risks Major Implications from Non-Enforcement

When the Foundation was established, it’s stated goals were inspired by the Mozilla Foundation, as much of the philosophy of open-source development and products in the WordPress world are. It’s important to point out that, from a governance standpoint, the Mozilla Foundation and Mozilla Corporation, though closely tied, are governed by different people with similar but differently stated goals.

If Mozilla Corp goes outside the bounds of protected Mozilla.org auspices, you better believe that Mozilla.org is going to have something to say about it. The reason is simple… if you don’t enforce your own policies with your closest ally, friend and organization made from the same DNA, you leave yourself open to risk later on. Otherwise, you have a conflict of interest which is both legally and publicly difficult to reconcile.

Trey Roberts, a well-decorated Intellectual Property attorney of Roberts & Roberts in Austin, TX, commented to me that, “Though there is no ‘discrimination’ in a legal sense, since an organization has the right to choose what aspects of their licensing contract to enforce, if a pattern of suspended enforcement occurs, there is a risk of legal repercussions.”

Of course, some organizers see a level of subjectiveness in Foundation rules. Tony Perez, one of the organizers of WordCamp San Diego, lamented, “Often case when a request would be made, the response would be,’we would prefer not.’ When the question was asked, ‘well why not?’ the response was not very clear or decisive, so the decision felt as if it was in limbo. At the same time, you almost felt bad going against the recommendation, so it starts to become easier not to ask, than to ask.”

Opportunity exists though. “I can say though that it’s a necessary evil, but perhaps its time to think outside the box on the approach,” says Perez.

I love WordPress

I write this post not to bash WordCamp, the WordPress Foundation or any individual involved. In fact, I love WordPress. My professional career is Proudly Powered by WordPress. I want the Foundation to succeed as an organization charged with the governance of the software and events around it – and it is making strides to become a respected, independent governing organization. But conflicts of interest (or perceived COIs) do not provide a healthy community atmosphere and it causes bad blood among other WordCamp organizers. It, in fact, keeps potential organizers from wanting to jump in the mix. Or former organizers (like myself) from wanting to participate.

One former organizer, Amanda Blum, who has been a frequent critic of the Foundation tells me she won’t organize another WordCamp but she “still actively advises other camps [sic]” and “all I hear is complaints”. She goes on to express a concern about “the vast chasm between what the Foundation thinks Camps [sic] purpose is, and what the attendee interprets.”

Policies of the WordCamp Foundation around WordCamps are heavy-handed, in my opinion. There should be education (and there is some) around how WordCamps should be organized. Perhaps the rules that require WC money to be funnelled through the Foundation are merited (I actually do agree with this for non-profit reasons). However, where possible, it strikes me as necessary (and in fact, opportune) for local organizers to be able to blaze their own path and put their own local stamp on their own local WordCamp in almost every case. When it comes to sponsorship level, a WordCamp in NYC is likely going to cost more on orders of magnitude than a WordCamp in Omaha. One size shouldn’t fit all and the discretion should be left, with guidance from the Foundation, at the local level.

Mullenweg states, “The guidelines on Central encourage lower per-company sponsorship levels to encourage more sponsors per WC, decrease reliance on a single sponsor (we’ve had them flake out before), and have a level where even smaller firms can participate. It also hasn’t appeared to be a hindrance to larger city WordCamps, with NYC and Boston both raising 20k and putting on great events.”

Jane Wells, who helped to draft the original rules, tells me that the Foundation does try to not take a one size fits all approach to WordCamp’s and that they try to assist local WordCamps with financial assistance for venues, etc when needed. It does seem there is a perception among many organizers like Perez that this is not the case. One area where better communication between the Foundation and organizers may occur is at a new community blog that just went up.

With the spirit that this article is written with, I hope the Foundation, Automattic and the community take this as constructively confrontational. I do not wish to throw anyone under the bus, but change needs to happen for the integrity of the community. I cannot and will not be attending WordCamp SF this year or in the future, as long as these grievances continue year after year. I, however, will be at WordCamp Las Vegas and possibly Baltimore in the months to come, and I hope to see you there.

Corrections: Inserted a reference to WordCamp Central that serves as a central organization point for WordCamps. Also, updated the date for WordCamp Las Vegas to Oct 6, 2012. Corrected some content flow (paragraphs inserted in the wrong place) and noted that Matt did not choose content in 2011.

Read More