Connor Wilson
  • Home
  • About
  • Archives
  • Contact

Musings on design, sports and life.

connorwilson: doing my rotator cuff exercices

Follow me »

Quicksilver Style Livesearch with WordPress

Posted on September 1st in General — 16 Comments so far. Got something to say?

Over at OrderedList, John Nunemaker wrote a guide on using jQuery (or Prototype, whichever works for you) to implement a Quicksilver Type Livesearch. QuickSilver is an awesome Mac app that lets you search through your apps, files, etc… By typing fragments of a string. From there you can launch apps, open files, and tons of other options.

I just type 'F' an it presents Firefox.

I just type 'F' an it presents Firefox.

Get Your Files Setup

There’s a few Javascript files you’ll need to setup before we can start editing our WordPress theme. Here are the files you’ll need to save and upload to your theme’s folder:

  • Quicksilver.js — This processes the input and gives back a value based on matches with the search area (our posts).
  • Livesearch jQuery Plugin by John. This is what makes everything work together, with the live input and the search area.
  • And of course, you’ll need to go get jQuery.

Now set those files up in header.php like this:

<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/jquery.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/quicksilver.js"></script>
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/scripts/jquery.livesearch.js"></script>

Once that’s setup, it’s time to get going on the real stuff.

Archive.php vs. Archives.php

Before we continue, I’m just going to clear something up. There are always these two files in your theme’s directory, but what’s the difference? Basically, one is a page template and the other is the display for the archived posts, like dated archives and the like.

  • Archive.php is the archive that shows posts based on date, author, category, etc… This is the file we will be editing!
  • Archives.php is the page template, which in the end just links off to pages that use the former page to display.

If you go to the archives link at the top of this page in my navigation, it will take you to my Archives.php page. If you click a link on that page, it will take you to my QS Livesearch enabled Archive.php.

Modifying the Loop

What we’re going to do is basically put all the posts we have in a list so the JS we downloaded can do it’s magic. Find the loop in your archive.php file and we’re going to change it to the code below. I’ll explain it after.

<?php if (have_posts()) : ?>
<div class="post">
<form method="get">
<div class="livesearch">
<input type="text" value="" name="q" id="q" />
		</div>
</form>
<ul id="posts">
	<?php while (have_posts()) : the_post(); ?>
<li><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></li>
 
	<?php endwhile; ?>
	</ul>
</div>
 
<?php else : ?>
 
Oops, no posts!
 
<?php endif; ?>

This is going to display the form and text input that users can use to refine the posts on the page. It’s also going to take all the posts and put each one in an LI. The reason we only display the title is because the script searches through all the text in each LI. Besides that, it’s nothing fancy. Get the posts, display the posts to work with the JavaScript.

Potential Problems

The first thing I ran into with this was that if you have a low number of posts per page, you won’t get many items to search through. You can try writing different queries for each option, but in the end, there is a plugin that can fix this. It’s called Different Posts per Page.

A word of warning — you will need to sign up for their stupid newsletter to activate their plugin. It’s worth the trouble, though. Just block the letter if you don’t want it, because this is the easiest solution to the problem.

Next, it’s always possible that you might have uploaded your JS files into a different directory than the /scripts/ that I provided in the code. Make sure the files are included properly before asking any questions, because this is the number problem that users have when doing something involving JavaScript.

If you have any questions that don’t fall into those two common errors, then feel free to leave a comment and I’ll help you out. You can see the example as I mentioned above, right here an my site. For instance, go check out my Design category page.

Posted in General with 16 Comments.

A Resurgence of Tutorial Sites

Posted on August 30th in General — 23 Comments so far. Got something to say?

Everybody gets their start somewhere. My entire entity on the web and the skills that I have as a designer and developer are because of a few things. This is going to be a terrible reflection on past and how ended up “here”.

Some people are naturally drawn to certain things. I’m obviously drawn to my computer chair, but I have an equal passion for sports. An odd combination, but I digress. I remember the first day I had the Internet, and just the awe it induced. Shortly after that I was instantly interested in creating my own website and learned bare bones HTML. It might have been a black page with giant white text saying “My First Website” but it was an accomplishment.

Sometime after that, and all HTML forgotten, I managed to get into graphic design. And by graphic design I mean making cool looking abstract wallpapers in Photoshop. I think sometime around 2002 I had a trial copy of Photoshop 7. I wasn’t exactly net savvy at this point, so it expired. The pinnacle of Photoshop tutorials at this time was Good Tutorials. I’d spend hours just finding cool effects and recreating them on my crappy little PC.

Eventually the whole Kazaa thing got to the harddrive and after reformatting I once again got my trial back. Of course I had no idea that you could just grab a serial key of the ‘net and have it forever, so it expired again. This is where the seed was planted. What I was doing wasn’t particularly creative, but it was fun an produced a myriad of effects I could be proud of at that time.

Fast forward a couple years, I had already designed my first website, but still had no idea to get it from Photoshop to Internet Explorer (oh, yeah). In fact, when I found out that Photoshop is what you used to design them in the first place was a revelation. Go figures that I would learn to code HTML right before the whole CSS uprising. The Slicing Guide taught me how to use sliced Photoshop images and use Dreamweaver to turn them into websites.

Sooner or later I took to finding a way to make things easier, more dynamic and bigger. I came to the conclusion that PHP was what I needed, and shortly found out after I needed MySQL to go with it. At this time I was on a free host with a “blog” that I maintained with static HTML pages. Imagine updating that! Coming into programming showed me a whole new community of tutorial sites.

This got me into paying for hosting and actually having a domain name. I’ll spare the details but I basically got really good at PHP by taking other people’s code and learning to modify it to my needs. Sooner or later I could just write it myself with MySQL to boot. During the development of this theme it was nice to get some MySQL queries in amongst the WordPress stuff just to know I could still do it.

The unfortunate bit of this is that these coding focused tutorial sites were rampant with immiture kids looking for new systems for their Habbo Hotel fansites. It wears on you if you’re serious about getting better and developing websites, and it did. I remember when the main site I learned pretty much everything from was sold for $1000 and I was amazed. It went in the tank from there, but not without starting my freelance “career”.

The Point

I’m going somewhere with this, trust me.

I had basically abandoned these sites because I was focused more on designing and getting myself established and my blog afloat. I did eventually go back for a while but that ended ugly. When you have temperamental kids running your sites, someone as honest as I am can get on your nerves. I went from a forum moderator to a disgruntled member because I spoke my mind. Live and learn - actually, don’t learn. I’m still going to be honest if you ask for my opinion.

The amazing thing about that whole scene is that it’s huge in the form of blogs. Gone are the forums, shoutboxes and poorly designed websites. The TUTS network (PSD, Vector, Net, Audio, etc…) has given me faith in the web’s educational programming.

I’m not about to start a copycat site like the many that have sprung up, but what these sites allow is for newcomers to learn properly. If you read any of the above, it’s obvious I didn’t learn properly, starting off with tables and Dreamweaver. I had no idea what a standard was or how to write CSS on my own. I had to figure all that out on my own by asking stupid questions, but now it’s all out there.

It still kills me how I can have a teacher try to teach like HTML 3 with no CSS at school, yet anyone nowadays can pick up a laptop and be a client side expert in a matter of days.

Posted in General with 23 Comments.

How to Create a WordPress Login Form Overlay

Posted on August 25th in General — 6 Comments so far. Got something to say?

For those that have seen the feature I coded up for my recent redesign and were curious as to how it’s done, you can see it over at ProBlogDesign!

WordPress is more than just a blogging tool. It can be used as a Content Management System (CMS) for many different purposes. It has a built in system for most things you would have to code yourself, or pay for an expensive custom application. With a little creativity, you can use basic features to power almost anything you want.

Go check it out!

Posted in General with 6 Comments.

Jays vs. Red Sox

Posted on August 23rd in Sports — 5 Comments so far. Got something to say?







Not much to say besides the Red Sox got defiled 11-0. Awesome. On Flickr »

Posted in Sports with 5 Comments.

New Design and Overall Changes

Posted on August 21st in Design — 16 Comments so far. Got something to say?

RSS Readers — Come check out the new design!

RSS Readers — Come check out the new design!

It’s been a couple months, eh? Oh well. One thing I’ve always said is after a long time without posting to try and avoid referencing it. So I won’t.

That being said, the reason I didn’t write anything since early April was due to a lack of ideas and the will to write them. A year ago I was posting twice a day and going strong, but after a while I guess I had a dip in the passion.

The New Design

I’ve always had troubles designing for myself in a way that represents my own style. It seems odd that I can put a personal touch on a design for someone else more than on my own site. I probably just over think it to the point where I doubt the design.

So, with this I get across a few things that I like to have in a design. It’s simple, linear and sits on somewhat of a grid. Also, there isn’t any blue. Hard to believe for me, but the last couple things I’ve designed have been devoid of blue. I’ve been trying to put a brown/orange/white scheme together for a while now, and finally it got developed far enough where I can actually use it.

I wouldn’t call this my best work, or even the best design I’ve made for this site (one in particular that will never get developed comes to mind- too much going on in there), but it suits my cause.

Overall Changes

I’m going to continue writing about web design, WordPress and all the other things I was focusing on before. I have a bunch of new WordPress stuff I worked into this theme that I’ll write up tutorials on, but I’ll touch on that later.

I didn’t post for ages because I didn’t have anything write about web design. Considering that’s not my only interest, I’m going to write about pretty well whatever I want now. I’m going to clean up the categories and try to keep them around 10.

This will make the whole site more personal in a way, but at the same time more interesting because the focus will constantly shift.

Another reason I couldn’t put fingers to keyboard early on in the ‘drought‘ had to do with my infatuation for numbers/statistics. Seeing everything going up like I was trying to make it is a good feeling, but website statistics are eternally unreliable. Something I should have learned years ago when I got my first hit on a free host, but inevitably did not.

A couple months of not checking stats (actually took a while for me to stop) and I built up a solid wall of apathy. Hopefully it holds.

Nifty Things

While developing this theme I created some extra features which will go totally unused, but it was a good learning experience for me to do it. Before I was doing my own WordPress themes I had coded my own blogs and tutorial sites, so I was fairly proficient with PHP.

Over a year and a half of exclusively developing on WordPress has dwindled that. But, I did get to use some of those old skills in creating these new features. “Features” is a little powerful, actually.

These all basically revolve around being logged in, so you’ll have to sign up for my blog to see these.

  • Login Overlay. I made an overlay using a modified Lightbox script I found and some of my own code to make a login form overlay. I did this because I wanted to take out the inconvenience of logging into WordPress if you want to comment (and have an account).
  • See all your comments on a page and where you posted them. This is a logged in only thing, though.

That’s actually it. Anti-climatic, eh? Seemed like more as I was coding them. But it was fun (yes, fun) for me to write my own MySQL queries again without using query_posts().

That was a bit wordy. I’ll work some of the new blockquotes and stuff in the future ;)

Posted in Design with 16 Comments.

« Older Entries
Blog Categories
  • Apple (12)
  • Blogging (44)
  • Design (32)
  • Free Resources (4)
  • Freelance (4)
  • Friday Roundup (4)
  • General (45)
  • Ideas (16)
  • Improve Your Blog (7)
  • Learning Ruby (4)
  • My Sites (16)
  • Personal (27)
  • Quick (9)
  • Ramblings (30)
  • SEO (15)
  • Site Development (31)
  • Sports (1)
  • WordPress (22)
Subscribe

Get updates to the RSS reader of your choice by subscribing.

    Subscribe to RSS

  • Subscribe in a Reader
  • Subscribe by email
Search

You can search all posts on the site, or visit the full archives to look around some more.

Top Commenters
  • Funny Icons (2)
  • cat (2)
  • Armen Shirvanian (2)
  • Acne Free in 3 Days book (1)
  • Shaggy (1)
  • Hack (1)
  • Fred Campbell (1)
  • Audrey (1)
  • Marketing (1)
  • Tony (1)
Recent Posts

All content is copyright © Connor Wilson 2006-2008. If you want to use something just ask. Powered by WordPress.