A web developer's blog. PHP, MySQL, CakePHP, Zend Framework, Wordpress, Code Igniter, Django, Python, CSS, Javascript, jQuery, Knockout.js, and other web development topics.

Category Archives: General

jQuery: Generic Image Swap

Found this little gem in Stackoverflow. $(function() { $("img") .mouseover(function() { var src = $(this).attr("src").match(/[^.]+/) + "over.gif"; $(this).attr("src", src); }) .mouseout(function() { var src = $(this).attr("src").replace("over", ""); $(this).attr("src", src); }); }); Thanks to Jarrod Dixon. Here is another simpler version. … Continue reading

Posted in General | 2 Comments

Wordress: Using custom fields as key to sort queries with meta_query and meta_key

The example shows that I sort posts with custom field “Start Date”. I am using ‘meta_query’ to query the custom fields – you can find out more here. $args[’post_type’] = array(’ur_post’, ‘programs_post’, ‘education_post’, ‘blog_post’ ); $args[’meta_key’] = ‘Start Date’; $args[’meta_query’] … Continue reading

Posted in General | Tagged , , , , , | Leave a comment

HN: Better RESTful approach

Someone (bradgessler) in HN made a very good comment in this thread. I’m just going to copy-paste everything. Source. The biggest problem with today’s REST implementations is that they’re essentially a database serialization layer. Consider how a RESTful Rails model … Continue reading

Posted in General | Tagged , | 2 Comments

New blog theme

Okay, I just spent a few days coming up with new look for the blog. It is based on the WordPress + Blueprint Barebones/Skeletal (or whatever you call it) theme. This is still a work in progress and if you … Continue reading

Posted in General | Leave a comment

WordPress: Multi-language translation for your theme

Although, there are more advanced multi-language plugins like qTranslate available, this post will deal with basic translations in your theme. Like for example, if you want to translate a “hard-coded” English strings in your theme. <h1>Programs</h1> … translated into French, … Continue reading

Posted in General | Tagged , , , | Leave a comment

CSS: Simple cross-browser DIV shadows

I am posting this for myself and for my brother, John (haha). <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> </head> <body> <style type="text/css"> .Example_F { -moz-box-shadow: 0 0 5px 5px #888; -webkit-box-shadow: 0 0 … Continue reading

Posted in General | Tagged , | 1 Comment

WordPress BlueprintCSS Skeletal/Bare-bones/Blank Slate Theme

It has become my habit that when designing a website, I always use the template that comes with the BlueprintCSS download. I always make sure that my design “fits” BlueprintCSS. I am sharing my WordPress-BlueprintCSS Skeletal Theme. The theme is … Continue reading

Posted in General | 2 Comments

WordPress Template Hierarchy

For my personal consumption.

Posted in General | Leave a comment

WordPress: Post Types and Page Templates

Aside from the normal “Add Post” link in the WP-Admin Panel, you can add a custom post type. See http://codex.wordpress.org/Post_Types#Custom_Types. For example, if you want to add “Videos and Podcasts” as another post type, you put this in your functions.php … Continue reading

Posted in General | Tagged , , , , | Leave a comment

Django: Creating multiple select checkboxes with Forms

I got stuck for almost an hour trying to create a multiple select checkbox. Here is how to do it: First, I put this in my forms.py class UserlistForm(forms.Form): users = forms.MultipleChoiceField(widget=forms.CheckboxSelectMultiple,label="Notify and subscribe users to this post:") Then in … Continue reading

Posted in General | Tagged , , , , | 3 Comments