Added a few bells & whistles to the blog

Aside

Hey people, I want to point out a few improvements made to this blog in recent days. They have been stuck in my mind for awhile and I finally got around to getting them done.

First of all the sidebar has these huge links at the top now. If you want to learn more about me and are on LinkedIn, Facebook, or Delicious then I suggest you click them immediately. The real cool thing about these links is they are actually all one giant image. The two main reasons to create them this way; first it reduces the number of HTTP requests your browser makes which decreases load time, and second it completely bypasses any flash between hover states if you mouse over an image. The technique is called CSS sprites and you can find many tutorials on creating your own throughout the web.

While I was at it, I created a CSS sprite for the social bookmarking image links under the title of all our posts. That saves 7 HTTP requests alone, but I also added a little jQuery magic to animate them to appear to float up if you mouseover one. Amazing how just a little animation has so much effect on User Experience!

Another cool feature is the “Top” link in the bottom right, it has been there for awhile now but I was unhappy with the fact that it would be shown even if you were at the top of the page already! So I found an elegant jQuery solution and modified it to fit my needs. Now if you scroll the page down it appears and if you go back to the top it disappears. And so it is that jQuery once again saves the day.

Another thing to mention is all the jQuery I use is unobtrusive meaning it won’t break anything for people with javascript disabled.

What good is a post without some code? Here is the jQuery code I used, sorry but it comes with no explanation or support!

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js' type='text/javascript'></script>
 
<script type='text/javascript'>
$(document).ready(function(){
	$(function(){
		$.fn.scrollToTop=function(){$(this).hide().removeAttr("href");if($(window).scrollTop()!="0"){
		$(this).fadeIn("fast")}var scrollDiv=$(this);
		$(window).scroll(function(){if($(window).scrollTop()=="0"){$(scrollDiv).fadeOut("fast")}else{$(scrollDiv).fadeIn("fast")}})
		$(this).click(function(){$("html, body").animate({scrollTop:0},"fast")})}
	});
 
	$(function() {
		$("#toTop").scrollToTop();
	});
 
	$(".share-container img").mouseover(function(){
		$(".share-container img").animate({
			top: "-10px",
		}, 500 );
	});
});
 
</script>

Why I used uPrinting.com

Aside

Most of my graphic design clients want to take care of the printing arrangments themselves, this is fine as long as the printer follows certain standards and has a good prepress department. The trouble comes when the design is ready but the printer is not, or they mess up your design and blame it on you. Now this has not happened to me personally, but I have heard, on this thing called the internet, that it has.

About a month ago uPrinting.com contacted me as part of a sponsored blog program they have. I accepted their offer of an undisclosed amount (it wasn’t huge) to place some links to their site on my sidebar for three months. So when it came time to get my own business cards as well as cards for a client I naturally wanted to test them out. I was surprised and delighted by the user friendly process of ordering your print materials online. It is as simple as choosing your product, size, and options and uploading your design in a large range of file types. They also provide very nice templates for all their print materials so you wont have to worry about adding the bleed and trim guides in Photoshop. Once they have your files they will provide you with a free PDF proof (At least for business cards) or a hardcopy proof if you prefer for an additional cost.Easy user interface, plus one for uPrinting.

I got my PDF proof fresh from their prepress team in only a few hours and they both looked great, I had some doubts as their upload preview looked a little blurry and had a white line on the right, but the PDF proof looked much better for both designs.

After you approve the proof’s you move onto the payment tab. I had some trouble adding shipping and billing details at this stage due to a modal dialog box that apparently does not work well with Safari 4.1 Beta, but once I switched over to Firefox it seemed to worked correctly.

I am still waiting for my order to inspect quality, I will post pictures once I get them in around 7-9 days with the UPS ground option that cost me $15.97 from an hour north in Los Angeles.

Why UPrinting.com isn’t your average printing company:

Blog Sponsorships:
If you are looking to find a sponsor for your blog, UPrinting.com is definitely interested. We offer giveaways, advertising and more for qualified bloggers.

Non-Profit Sponsorships:
The U-Community Program sponsors hundreds of non-profits and education to improve our local communities.

Social Justice Projects:
The UPrinting Kiva account promotes small business growth in developing countries.

Green Printing:
UPrinting supports a sustainable future by recycling, using non-toxic inks, and offering eco-friendly recycled paper stocks for business cards and postcard printing.

10% OFF All UPrinting Products!

How To: Use expandable div’s in jquery.

Aside

For anyone who has ever had to much content and not enough space on a page here is a quick snippet of code that allows you to have expandable parts of your website. It is very flexible and works in all browsers. As you can see with just a few lines of javascript and re-useable classes you can add much more content onto a smaller area. Also note that the content is hidden only if you have javascript enabled for accessibility. I hope for comments & questions!

You need to include the jQuery library in the head of your document, I reccomend using googles servers as they are fast and reliable. Simply add the following into the head section of your site

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>

This is the html:

<h2 class="msg_head">This is the open/close anchor</h2>
<div class="msg_body">This is the content that is toggled up and down.</div>

This is the javascript:

<script type="text/javascript">
// load script once the page is done loading //-->
$(document).ready(function(){
  //hide the all of the element with class msg_body
      $(".msg_body").hide();
  //toggle the componenet with class msg_body
      $(".msg_head").click(function()
  {
      $(this).next(".msg_body").slideToggle(600);
  });
});
</script>

You can change the numerical value in slideToggle(*) to any speed in you desire. The lower the number the faster the slide.

demo

Blog updates + new biz card design

Aside

Hey everyone who reads this. So I did a few updates to the blog for usability and because I am a designer and that means I spend at least 2 hours a day working on my websites for fun!

1) You can log in through using an OpenID on the register page or on the comment forms below each post. Open ID is awesome, go here to read more about about OpenID.

2) Expandable twitter tweets and delicious links in the sidemenu. Click them twice to open and once to close or open again. (poor jQuery coding on my part, can you fix it?)

3) Thats it I think. Oh ya I added the rss icon on the top right.

Now here is a video of my new business cards that is hosted on my blip.tv channel.

How To: Show future posts in wordpress

Aside

Have you wanted to display your upcoming posts on your wordpress blog? I have been wanting to plan out my posting for this blog for awhile. Normally I just get a whim to post something and do it from start to finish. This brings about sloppy posts that need to be updated a lot. The solution for me was to create a “draft” of the post I thought of and work on it as I did more research or had a new idea. I know their are plugins for this but I generally like to do things myself and by not using a plugin it keeps the loading speed fast.

When I think of upcoming posts I think of both scheduled and ready post as well as saved drafts so the code I used shows both. It is easy to change to one or the other however and the change is included below. So here is how I put my upcoming posts on my sidebar.

  1. First I opened up my sidebar.php which can be edited under Appearance on the dashboard menu. Or be a geek and use ftp and a text editing program. This is much safer because you can backup your file if you make a mistake. First download the file your changing to your computer as a backup. Then select the sidebar.php file on the server and “edit” it from your a ftp program. Here is a good list of FTP applications for mac or windows and linux.
  2. Found a good place for the future posts to go. What order, If you have widgets enabled put it above or below the widget php code.
  3. Add the following code into the sidebar.php file inside of a div with the same class the other div’s use. A good way to do it is look at the structure of any other sidebar div. So if you see this:
    <div class="sidebar-box">*code*</div>

    then you know you can put this code inside another

    <div class="sidebar-box"></div>

    and it will look alright (hopefully). Make sure not to copy a div with a id because ID’s can only be used once while class’s are made to be used on multiple elements

<?php
$my_query = new WP_Query('post_status=future,draft&showposts=10');
?>
<div class="sidebar-box">
    <?php
    if ($my_query->have_posts()) : while ($my_query->have_posts()) :
        $my_query->the_post();
        ?>
        <ul>
          <li>
           <?php the_title(); ?>
          </li>
        </ul>
    <?php endwhile; else: ?>
        <div>
        <ul>
          <li><?php _e('No upcoming Posts'); ?></li>
        </ul>
        </div>
    <?php endif; ?>
</div>

If you want to customize it a little more:

You can of course can add a header above the code to tell visitors what they are seeing. Usually wordpress themes use a h2 header.

So right after

<div class="sidebar-box">

add something like this:

<h2>Upcoming Posts</h2>

Their is also a timestamp available for scheduled posts that can be added with this code but it shows the date a draft was saved. So only use it if you are just showing future posts and not drafts.

Add

<?php the_time('l, F jS, Y') ?>

after

  if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();  ?>

You can also put the code wherever you want in your theme by removing the sidebar-box class from the code.

Of course any questions or feedback would be appreciated! The original code I used was from Kishore on his blog post: Display UpComing Posts on your Sidebar – WordPress Blogs