Theme Experiments with TwentyTen and Git

I am doing some experiments with the TwentyTen theme and Git.  Up until very recently I have never used Git, I’ve done all of my version control with Subversion.  With Git gaining in popularity, I see more and more WordPress projects using it.  I figured I ought to educate myself.

I recently picked up the O’Reilly Version Control with Git book.  On a recent trip to Phoenix and back I read through a fair amount of it.  I have found that nothing forces you to learn how to do or use something like having a real problem to solve.  You can take training classes, read books, attend lectures, etc. but you’ll never really learn until you have to actually have to apply the material to solve a real problem.

It was like that for me with Git.  While I’ve used Subversion for quite a while, I was having a tough time getting my arms around the concepts of forks, pushes, pulls, etc.  For all practical purposes, I still am but I am getting there.

I like the idea of child themes.  I have no desire to completely reinvent the wheel.  The  guys who put out WordPress are smart and clever and have done some nice themes that work well.  In particular, I like TwentyTen as a parent theme and have done a couple child themes from it.  I find myself using some of the same ideas and plugins across these theme projects so what I’d really like is a core child theme that I can adapt or build from that contains all of the things I like and have figured out already.

So while reading up on Git I envisioned being able to use it to build a base theme that I could adapt to several others very quickly.  If I made a change it would propagate out to the other themes that are based on the base theme.  At least that is the theory.  I am still not sure if it will work like that or not but I’ve decided to try.

For the past day or so I’ve assembled a TwentyTen child theme I am calling TwentyTen-ACME.  Why ACME?  Because it is a pretty generic name.  ACME was the company that provided everything to Wile E. Coyote in the Road Runner cartoons.  ACME is the definition of generic!

So now that I have my base theme pretty much done, I am going to build a derivative from it for a project I am doing for our middle school.  Shortly there after I am going update my LEGO theme which is based on Sandbox and is long overdue for an update.  I am hoping that as I need to push changes back to the base theme I will be able to flow them back out to the others quickly.  We’ll see.

WordPress Google Form v0.39 released

This morning I released v0.39 of my WordPress Google Form plugin.  This update addresses the corner case exposed when using WordPress Google Form with the Unite theme from Paralleus.  To solve this incompatibility I’ve introduced a new short code attribute called unitethemehack which defaults to off.  By turning it on, WordPress Google Form will modify the Google Form HTML to protect the Submit button(s) from being manipulated by the Unite theme.

You can find this update in the WordPress plugin repository or as an update on your WordPress Dashboard.

Sandbox-LEGO theme v3.0.368 available

After updating my Sandbox-SwimTeam theme, I turned to my Sandbox-LEGO theme.  Like Sandbox-SwimTeam, Sandbox-LEGO is built on top of Sandbox and shares quite a bit of the same feature set and code.  Once I updated Sandbox-SwimTeam, migrating the same changes over to Sandbox-LEGO was pretty straightforward.

If you have a LEGO web site, this a great theme for you!  You can see this theme in action on my CarolinaTrainBuilders.com web site (although I don’t do much with LEGO any more).  You can download the theme from the Sandbox-LEGO theme page.

Unlike the update to Sandbox-SwimTeam, this theme update will retain your settings even so you don’t have to re-enter them.  I need to migrate this same logic back to Sandbox-SwimTeam too now that I’ve figured out a solution I am happy with.

Sandbox-SwimTeam theme v3.0.360 available

It has been a while since I touched my Sandbox-SwimTeam theme but with Swim Team season gearing up, it was time I did some maintenance as I had put it off last season.  A lot has changed in WordPress since I originally put this together almost four years ago.

I have just released v3.0.360 of the theme which you can download from the Sandbox-SwimTeam theme page.  This update has a lot of bug fixes, most of which bring it update to date with WordPress 3.3.  The big new feature is support for WordPress Navigation menus.

Important:  You will need to re-enter your theme settings!  The way theme settings are stored is different from the original implementation and there is much more checking done now.  The theme now properly  uses the WordPress Settings API.

I had wanted to build a new theme for our Swim Team this season but time to do so is elusive.  I’ve decided to do a short term fix and update Sandbox-SwimTeam which will give me some breathing room to work on a new theme over the next few months without impacting the swim team adversely.

TwentyEleven Child Theme Learnings

For the past week or so I’ve been playing around with a TwentyEleven child theme for a soccer team project I am fiddling with.  For the most part I’ve been able to accomplish what I want using a TwentyEleven child theme.  Using TwentyEleven as a base for this project isn’t bad but it certainly is different than using a theme framework (e.g. Thematic).

Last week I had posted that I didn’t care much for how the header was constructed and after working with it for a week, I still feel that way.  TwentyEleven has a number of filters and actions but customizing the header isn’t among them.  I also find it very odd how the default behavior is to use featured images as the header if there is one available.  I can’t imagine what application that turns out to be a good thing.  Fortunately it is fairly easy to disable that and set your own header.

TwentyEleven has a showcase template that is sort of like a magazine style but not exactly.  For it to work it requires that posts be tagged as “sticky” which also means they appear at the top of the list in a standard chronological post view.  What I really wanted was functionality like the showcase for the latest articles and let that view become the default home page.  I was able to accomplish this by copying the showcase.php file from TwentyEleven into my child theme directory and calling it latest-news.php.  I now have a new template that shows the five latest posts using the featured content slider which TwentyEleven has built into the showcase template.

Now that I have it working, I am finding that images in the showcase template are wonky and adding a featured image really messes things up.  I am sure I’ll figure it out but the decisions the theme designer(s) made in this area are odd.  It’s like having an 80% solution but the other 20% will take a while to work out.

The one thing I am pretty happy with though is how well it seems to work on my iPad and I didn’t have to do anything special to make it work.  It just works which is nice.  Once I am done with this I will probably turn it into a generic soccer theme but for now it is really only useful for CASL teams.

TwentyEleven Child Themes

Yesterday I was perusing one of the WordPress feeds that I follow and saw a mention of WordPress and Responsive design.  In a nutshell, Responsive Design means that the theme will work well on a variety of displays from large screens to laptops to Tablets (e.g. iPad), to SmartPhones (e.g. iPhone).  Since I own both an iPhone and iPad, I was intrigued by the presentation.

I haven’t had time to watch the whole video yet but later in the day I started playing around with a TwentyEleven child theme thinking it might be a good basis for a new Soccer Team site I am playing around with. I had planned to use Thematic but the more I think about it, the more I want to make sure that whatever I do will be easy to keep up to date and actual be a minimal amount of code.  A TwentyEleven child theme may just be the ticket.

While there is a lot to like in TwentyEleven, I really dislike the way the header is constructed.  So far it doesn’t look like it is easily overridden with filters and hooks either.  I hope I am wrong but that is my perception after looking through some code and several Google searches.

How to have a Meta Box appear before the Visual Editor

I am working on a new theme where I have defined a Custom Post Type.  This is my first time working with Custom Post Types and I must say they are pretty slick.  I wish they had existed back when I first started working on my Swim Team plugin!  I have far too much invested in my Swim Team plugin so I’ll stick with the custom database tables but for this new project, CPTs are working great.

Once I got my CPT defined and basically working, I wanted to add some custom fields to it using a Meta Box.  There are numerous articles that outline how to do it, I referenced this one quite a bit and found it very helpful.  In my instance, the Meta Box that holds all of the custom fields I want to collect is more important that the Visual Editor is so I wanted it to appear higher on the screen.

After poking through the Codex and number of Google searches, it appears that doing what I want to do isn’t native WordPress functionality.  I did however find this post which outlines an idea for moving the Meta Box so it appears on top of the Visual Editor.  Awesome.  Exactly what I was looking for. Except the code fragment didn’t work.  After looking at it, I decided the idea was sound but the implementation wasn’t correct or at least wasn’t correct in my application.

I tweaked the Javascript to make sure the document was ready before rearranging the Meta Box and Visual Editor and got the result I was looking for.  Here is the code I am using in my functions.php file.

/**
 * Set up a footer hook to rearrange the post editing screen
 * for the 'CPT' custom post type.  The meta box which has all
 * of the custom fields in it will appear before the Visual Editor.
 * This is accomplished using a simple jQuery script once the
 * document is loaded.
 */
function CPT_admin_footer_hook()
{
    global $post ;

    if (get_post_type($post) == 'CPT')
    {
?>
<script type="text/javascript">
    jQuery(document).ready(function($) {
        $('#normal-sortables').insertBefore('#postdivrich') ;
    }) ;
</script>

<?php
    }
}

/**  Hook into the Admin Footer */
add_action('admin_footer','CPT_admin_footer_hook');

Hiding a Google Form’s Title

Since a WordPress page or post will have a title, there is a good chance the Google Form’s title is redundant.  If hiding the title from the Google Form is desired, the easiest way to do it is with CSS.  The title on a Google Form is an H1 element  which is assigned the class ss-form-title.  To hide the title, we add the following CSS to either the theme’s CSS or to the CSS overrides available with the WordPress Google Form plugin’s setting menu.

h1.ss-form-title {
    display: none;
}

Using my Sample Form, here are the results of adding this CSS to the plugin settings.

Form before adding CSS

Adding CSS to wpGForm settings

 

 

Form After Adding CSS

WordPress Google Forms include quite a few CSS classes so using this technique, the appearance of the form can be customized quite a bit.

Support for multi-page Google Forms?

I received an email the other day about my WordPress Google Form plugin wondering whether or not it should work with multi-page Google Forms  It hadn’t even occurred to me to test it as none of the forms I had needed myself were multi-page forms but my gut reaction was I didn’t think it would work.

I took a look at a multi-page Google Form and have determined that the current (v0.10) version of the WordPress Google Form plugin (aka wpGForm) will not work with multi-page forms.  No real big surprise but I want it to be clear before someone else wastes their time trying to make it work.

From looking at the form code it may be possible to support multi-page forms in the future but it will require some additional jQuery scripting and more importantly, some time to dedicate to it.  I hope to look at this soon but I have a couple of WordPress theme projects that I need to get off my plate before I can go back to wpGForm.