Template parts as widgets

On a project this morning, I had a need to pull in some formatted content into a sidebar. My first inclination was to A) Use a plugin like Query Posts to pull it in or B) Write up a custom widget we could use. I opted for neither.

The thing is, we’ve already got the content formatted into a template part file and the effort involved to roll it into a widget really wouldn’t be worth the effort. This isn’t a client project, so it doesn’t necessarily have to be pretty on the back-end … it just has to work. So I opted for using get_template_part().

The nice thing about using get_template_part() to include WordPress templates is that you can call them from anywhere in your theme. And with a bit of help from something like Otto’s PHP Code Widget plugin, you can even include them in sidebars! Some people might see it as a bit of a janky way to accomplish it, but it got the job done.

It’s pretty straightforward:

  1. Install PHP Code Widget
  2. Create a template part in your theme/child theme directory
  3. Add an instance of the PHP Code idget to a sidebar via Appearance > Widgets
  4. Insert a get_template_part() call to include your template part

New local-to-live deployment plugin falls a bit short

A new local-to-live deployment plugin called WP Live Server Deploy was brought to my attention last week by a post over at WP Force.

The plugin boasts an automated set of features to handle the menial tasks of MySQL dumps + find & replace, plus handling your file transfers. Out of the box it seemed pretty promising. I’d say the biggest disappointment out of the box is a complete lack of SFTP/SSH support for the transfer. You can only do so much over FTP alone and the plugin failed miserably to handle the MySQL part of the equation.

Along that vein, there’s a so-called “Manual” option for handling the MySQL dumps. This would be fine, except that it doesn’t work — it nets an empty SQL file. I’d say @sagetarian has some work to do yet, but I’m looking forward to seeing another iteration. You can download the plugin via the WP.org repo and/or follow development on Github.

Don’t Let Support Get Lost in Translation

I was lurking in the #wordpress support channel on IRC last night and noticed somebody getting the shrug off for a support issue because he wasn’t a native English speaker.

Now, the advice I initially gave him was ridiculed by others in the channel as stupid, but without really knowing the guy’s issue I was doing the best I could with what I could decipher from his broken English. And its not like anybody else was giving it a go, so I invited him into a private chat to get a better feeling for his problem.

We went round and round, him explaining in broken English and me trying to be as clear and concise as possible. Finally, I offered to use Google Translate so he could explain in Portuguese. He was floored that I would do this, but we tried it anyway. Turns out, it made all the difference in the world.

We went back and forth like that, me doing hyperspeed copy pasta with Translate, him doling out the Portuguese and after a few minutes we managed to get his issue resolved.

The problem as I see it is this: WordPress is all about contribution, whether it’s code, knowledge or time. Turning new WordPress users off by turning them away doesn’t really garner much support for the community, especially with the non-English-speaking crowd (who by the way make up about 2/3 of the worldwide community!).

Many users who seek support in IRC support are novice-level and they’re just trying to figure things out. It really doesn’t take all that much extra effort to meet them half way.