Walkthrough for Week 2 Assignment

I will quickly go into how Assignment 2 could be solved.

For the first two items in the assignment (the custom login form and custom admin panel) you could use one of the many available plugins, see [1] and [2] in the resources section for my recommendations.

For the third item in the assignment (the custom widget) almost everyone in the class used a poll plugin. This was not what I wanted initially but reading the assignment now I can clearly see I led everyone in the wrong direction :)

The goal was to have a widget where in the admin you could choose your tribes and in the frontend you display them. Here is how the front view and the admin view could look like:

The Widget Barebones

Our widget needs an initial skeleton from where we can built upon. A widget can be created either through a plugin or a theme. In this case we will create a simple plugin that creates our widget. So to start you would create a directory ‘week2assign’ in the plugins directory and have a single file also called ‘week2assign.php’ containing:

This would be enough to have it in the plugins list and enable/disable it.

The Basic Widget

For a widget you normally need two functions, one to register the widget (register_sidebar_widget) and another to register the control function for the widget (register_widget_control). The first function has a basic template which you can see below and that is normally used:

This should be enough to start seeing your widget in Appearance->Widgets section.

The Widget Control

The widget control function is where you display the code for the widget controlling options. In this case it will be a checkbox for each of the possible options:

Because the list of checkboxes checked is kept into an array we need to use the serialize function in order to be able to save the array into the database.

A Small Enhancement

When you click save in the widget options you’ve probably noticed that the tribes you selected are not checked as marked. This is because although they are saved in the database, we didn’t check if they were marked. For that we can make a small enhancement to the control function to do just that:

You’ll notice now there is a is_tribe_selected function which is merely a function to check if a certain tribe is listed as checked. The code for this function is:

The Full Widget

The code for the full widget can be found here or downloaded here.

I hope this has been a useful walkthrough. Cheers and always Enjoy!


  • http://wordpress.org/extend/plugins/custom-login/
  • http://wordpress.org/extend/plugins/ozh-admin-drop-down-menu/

Week 2 Assignment

Client X was really impressed by the work you delivered last week. During the weekend he showed his blog site to one of his collegues and gave him your contact. You now have a second client, client Y, that would like some work done. Namely we would like you to:

  • Create a custom login form
  • Customize the admin panel (he doesn’t like the default panel)
  • Create a custom widget in the frontpage with multiple checkboxes:
    • What tribes do you belong?
      • Developers
      • Designers
      • Entrepreneurs
      • Hackers
– Provide a link to my e-mail and include your p2pu username and Week 2 Assignment on the subject for approval on this assignment.

– Be sure to drop by today (Wednesday) on Campfire (https://alforreca.campfirenow.com/c300e), we’re here to help you!

p.s. – as promised here the top 11 of last week’s assignment: http://bit.ly/fwOair


Week 1 Assignment Best Of

For the second week now me and Daisy (which is helping out with the course) are dazzled by the creative work people have submitted in response to last week’s assignment. As promised, here are the top eleven entries (it’s a Welsh thing!):


Great work everyone. Congratulations!

Walkthrough for Week 1 Assignment

A lot of people had problems with this assignment so I’m sharing here a walk-through of how it could be done. This assumes you started with the Twenty Ten theme installed.

  • Create a Twenty Ten child theme by creating the folder “wp-content/themes/twentyten-child” and a file style.css with the following inside:
    Theme Name:     Twenty Ten Child
    Theme URI:      http: //example.com/
    Description:    Child theme for the Twenty Ten theme
    Author:         Your name here
    Author URI:     http: //example.com/about/
    Template:       twentyten
    Version:        0.1.0
  • Copy the contents of “wp-content/themes/twentyten/style.css” into that file.
  • Create two post categories “casual” and “weddings”.
  • Add a post for each created category.
  • When you assign a category to a post it will add a CSS class automatically to that post, e.g. category-weddings for category weddings, so what you will need to do to style it differently is create that CSS class in style.css, e.g.:
    background-color: #F5FFFA;
    text-align: center;
  • That’s it, your posts in the category weddings will be styled differently.

Here’s an example of the end result:


Hackers Moving Away from WordPress in Favor of Cloud Aware Blog Engines?

Back in August last year we saw Harper Reed (link), ex-CTO of Threadless, moving away from WordPress in favor of Jekyll, a simple blog aware engine that allows you to host your blog on Google’s app engine.

Running your blog on the cloud (Google’s app engine, Amazon, etc) can have several advantages, ranging from cost to scalability, ease of administration, etc. but the thing with Jekyll as far as I see it is that it’s basically a static site generator.

Today also Richard Jones, Last.fm founder & ex-CTO, started converting his blog to Jekyll templates, according to this update status on Twitter. Is this is a tendency that will grow this year? I don’t know..

It seems to me a shame that we can’t run WordPress on Google’s app engine, or any other cloud infrastructure for that matter. But also I would be in terrible pain if I had to move away from WordPress in favor of static site.