code clips

Links Round Up for 10/31/10

Quick Tip: Custom Category Styles in WordPress

Over the weekend I revamped this blog’s current theme a little bit, including adding custom styles for my Link Round-up lists. I achieved this by adding a simple piece of code within my loop to make each category a CSS class. Here’s how I did it.

Note: You need to be at least a little bit familiar with the WordPress API, and coding themes.

Quick Tip: User Level Themes for Client Site Reviews in WordPress

Recently I launched a couple of websites using WordPress and instead of using a temp directory for testing/client review, I used a plugin & theme instead. Using this technique I didn’t have to worry about moving directories, changing the WordPress directory/blog URLs,  or checking image sources in posts. Here’s how I did it.

Create a Temp/Splash Page in WordPress

Often times I will be working on a WordPress theme that I want to live test, but I don’t want to reveal it to the world yet. The solution would be to throw up a temp page while you work. However, you may have noticed that throwing an index.html file in the WordPress directory or similar solutions break WordPress. Today I’ll tell you how to get around that.

Directory Handler at Theme Forest

I’m happy to announce my first Theme Forest component, Directory Handler. it’s a simple set of 2 classes that handle (in several ways) listing the contents of a directory. The main class, DirectoryHandler, includes several functions that:

  • Get and/or print the entire contents of a directory
  • Normalize the name of a file or directory (replace special characters with spaces)
  • Return the extension of a file
  • Return all of the files of a directory in an array
  • Return all of the sub directories of a directory in an array

TheImageDirectory class extends the functionality of DirectoryHandler by changing the get and print directory functions to:

  • Print a thumbnail version of the image
  • Integrate lightbox for easy image viewing/browsing.

You can view a live demo here and Download the full documentation here.

State Drop Down box

Today, working on a project, I searched for a ‘State Drop Down Box’ for a form. Believe it or not, I couldn’t really find one, and had to ‘borrow’ own. So figured why not add one that is easy to get to my site. on top of Code I have added ‘Code Cips as a category, and for this post, the slug is state-drop-down, so the url should be Easy enough, right?

Just copy and paste*! When processing the form, the variable name for it is ‘state’. Later!

*OK- it’s not showing up right in the textarea, but it will in an HTML doc.

Writing a User log-in

Here is the user login code I have been promising. It’s an image so it looks nice. You can download it at the bottom of the post. Keep in mind- This must be placed before the head tag in the page so if cookies are created, they can be…

This might not be the most efficient code, but it does work. To get the actual code, click here. And if you do make it better, please let us know in the comments! Later