WordPress and .gitignore

Updates have been added after the jump!

In the coming weeks I’ll likely put a lot of my own personal code (as in, not code people pay me to write) in public repos on Github. A lot of my work is WordPress related so I’ll make a local repo at the root of some WordPress install as to not complicate things. In order to make sure I don’t put up something unintentionally (like say, my wp-config.php file), I’ve created a more thorough .gitignore than what I have seen from automatic generators. If you’re interested, I put it into a Github Gist, so you can just copy and paste it. If you think I’m missing something or am wrongfully excluding something, leave a comment on the gist!

Github Gist: wordpress-ignore

Read More “WordPress and .gitignore”

GitGutter for Sublime Makes Diffs Easy

At Crowd Favorite we use git for everything, which is a nice change from my old workflow of hoping for the best. I’ve learned quite a bit about git and Github since starting and have looked for tools to help me do things better. A really simple, but super helpful, tool is the GitGutter package for Sublime (thanks Dave!)

It’s very straight forward: when you add, change, or delete a line, it will put small icons in the gutter of your file, with the line numbers, to make it easier for your to spot where you made modifications. It doesn’t seem like much, but I definitely miss it when I’m using a different editor or machine. Check it out!

GitGutter for Sublime

Use Input Masks for Better UX and Easier Validation

Recently I was developing a few forms for a project at work and wanted a fairly specific format for the input of one of the fields. It was a time of day, and since the <time> element isn’t very well supported in browsers yet, I opted for my own text input and validation. While I do provide some examples for users and check the input on the server side, I opted for input masks on the front end of development to make the form validation easier, and more importantly, to make using the form easier.

Read More “Use Input Masks for Better UX and Easier Validation”

Quick Tip: Check to See if a Slug Exists in WordPress

Recently I was doing some work where I was importing RSS entries into a Custom Post Type in WordPress. Since there were no common IDs between the feed and WordPress, to prevent duplicate entries I tried comparing titles. This also proved to be an issue as titles aren’t always unique, and they weren’t in this case. I settled on comparing slugs; WordPress creates a unique slug for each post from the title, and there’s a way to know what that slug is going to be before the post is added.

Read More “Quick Tip: Check to See if a Slug Exists in WordPress”


Quick Tip: Use Post or Page Slug as CSS Class in WordPress

I don’t know why, but for some reason, I thought WordPress already included the slug of a post or page in either the function body_class() or post_class(). Doing some work over this weekend I realized that’s not the case, but luckily, it’s very easy to do.

The functions body_class() and post_class() serve as a way for you to easily customize a page’s CSS based on attributes of the page being viewed. They will output things like the post ID, the custom post type, if the page is the blog, home, or front page, and more. One thing it does not include, however, is the post slug. This could be useful if you want to style each of your posts a certain way, or in a more likely scenario, style each page a certain way. If you want to do this, the code is fairly straight forward; both functions accept an option argument: a string of your own classes. We use that combine with the $post array, like so:

<?php body_class($post->post_name); ?>

or, if you want to do it on a post-by-post basis:

<?php post_class($post->post_name); ?>

Note the latter must be used inside the Loop. Using this, if you have a page named, “Services” with the slug services, the output would look something like this:

<body class="page page-id-108 page-parent page-template-default services">

Now you can use the .services (or whatever) class name to do some custom stuff instead of needing to know the page or post ID.



What is a Hackathon?

According to Wikipedia, a hackathon is defined as:

…an event in which computer programmers and others involved in software development, including graphic designers, interface designers and project managers, collaborate intensively on software projects.

Basically, it’s a place were people who work with computers can come together to hopefully make something awesome. There are all types of hackathons, from  ones that last a few hours, to 24 hour long, to ones that even last several days.

Read More “What is a Hackathon?”

| |

Simplecast Episodes and New Projects Page

Over the weekend, I announced on Twitter that I officially released a plugin I’ve been working on for a while called Simplecast Episodes, which allows you to add and embed podcasts hosted at simplecast.fm into WordPress. I’m happy to say that it’s officially in the WordPress Plugin Directory.

Read More “Simplecast Episodes and New Projects Page”


My One Month Learning Plan

I have a confession to make. Lately I’ve felt like my skills have been slipping, or at least stagnating. Part of it is because I’ve been so busy, but part of it is because of feeble excuses like, “I’ve been so busy.” This year I’ve resolved to do a whole bunch of things, including learn more. Before I WordCamp Phoenix, I devised a plan that would take place pretty much the moment I landed back in Scranton; WordCamp Phoenix really reinforced I need to do this. So, here is my one month learning plan.

Read More “My One Month Learning Plan”


I’m on Github!

I know it’s something I should have had for a while but I generally don’t feel my code is up to snuff. Seeing as I’ve been promising people my code, however, it makes sense. My username on @github is jcasabona. You can get to my repo using the link below.

My Github Repository

Right now you’ll find 4 of my own projects: My WordPress Boilerplate theme, my “Professor” plugin (mentioned at WPSummit and NEPAWP), a simple Flexslider plugin I use (may release a pro version of that one), and a Reading List plugin.

In most cases, I will upload in progress or abandoned projects here in hopes that someone will pick them up. I must apologize for one thing however, and that’s my code isn’t documented very well. I may try to do that when I have time.

Links Round Up for 10/31/10