I find it hard to believe that it is 2010 and we are still not able to watch live coverage of the Olympics online. With the technology we have available today, this idea seems like a no-brainer. I don’t care much for the Summer Olympics, but I am hoping that someone has this figured out for the 2014 Winter Olympics in Russia.
Where is my Winter Olympic streaming video coverage?
February 15th, 2010recent delicious bookmarks
Figuring out page vs. post in Wordpress development
January 26th, 2010I’ve had a Wordpress plugin in its infancy for about a year now and I’ve slowly been adding functionality. I recently added a feature where I needed to be able to tell whether the content I was looking at was a page or a post — from inside the code.
The is_page() function sounded like it would work, but that seemed to return true for both posts and pages. What worked for me was the get_post_type() function. This will return ‘post’ or ‘page’ depending on what content you are dealing with.
I know that I have spent far too much time searching for this functionality in the past, so here’s to remembering it for next time!
The Wordpress function reference for get_post_type() is here.
Post Thumbnails in Wordpress 2.9
January 6th, 2010Here is a nice write-up on using post thumbnails, a feature new to Wordpress 2.9.
New in WordPress 2.9: Post Thumbnail Images
Pretty simple to use if you are used to creating your own themes, and not a bad reason to update to 2.9 if you haven’t already.
Blog Freshness Wordpress plug-in
December 28th, 2009I have always been bad at maintaining a blog. Maybe I am just not meant to blog, but maybe, just maybe, what I really needed was a little nudge to keep me posting. That little nudge has come in the form of public shame. I’ve created a Wordpress plug-in that displays a badge in the corner of my site letting everyone know just how ‘fresh’ the blog is.
FRESH - Less than 7 days since last post
STALE - 7–30 days since last post
MOLDY - 30–60 days since last post
DEAD - 60+ days since last post
This is just a test to see if it helps keep me motivated, but I thought I would include the plug-in anyway. Maybe someone else will be motivated too.
Blog Freshness Wordpress plug-in
Hey, look! It is already working.
Great article on tweaking the Wordpress back-end
December 18th, 2009There is an article over at Smashing Magazine, called Advanced Power Tips for Wordpress Template Developers: Reloaded
It includes a number of tips ranging from modifying the logo on the dashboard, to hiding fields from different users. My favorite tip is ‘Adding a Custom Meta Box,’ which allows you to create a friendlier input box for custom fields. I created a plugin for Wordpress that does something similar to this, just not nearly as elegantly. Mine had a couple of extra features, but I think a rewrite is in order.
Creating and using Drupal user profile fields
November 14th, 2009I needed to add a new field, location, to the user profile on a Drupal site, and the value set in the location field needed to be displayed when the user made a comment on the site — like “Brian Dart | Seattle, WA”.
I found two great articles online that helped guide me to a solution:
Drupal: use user profile field in comment
Profile: extending user account information
These articles walked me through the steps of configuring the profile module in Drupal and then helped me understand how I could access the value from the code. Unfortunately, I could not get the code to work properly using the phptemplate_comment_submitted function. There was already a phptemplate_preprocess_comment function in the template.php file, so I added the following code — slightly modified due to the difference in variables that were available.
function phptemplate_preprocess_comment(&$variables) {
$user = user_load(array('uid' => $variables['comment']->uid));
profile_load_profile($user);
$location = $user->profile_location;
$comment = $variables['comment'];
if ( !module_exists('profile') || !$location) {
$variables['author'] = theme('username', $comment);
} else {
$variables['author'] = theme('username', $comment) . ' | ' . $location;
}
}
The location field I set up was called ‘profile_location’, and I am simply adding that on to the author variable, which is already being displayed on the comment. Not the most elegant solution, I am sure, but it served my purposes well.
Creating form templates in Drupal
October 28th, 2009Looking for a way to control your Drupal theme’s form output? I needed a way to control how the forms, more specifically the user forms (log in, register, etc.), were outputting onto the page.
This article helped me through the steps I needed to create templates for the forms and then style them accordingly. And, despite the article’s title, the same can be accomplished for any form in the Drupal system (edit: with the exception of Ubercart, but that isn’t Drupal core…). Great stuff.
