How to Use a Facebook Like Button on Any Page

   Posted: July 9th, 2010    By: Devin Walker   

The facebook like button is in. I know, you’ve been seeing it more and more around the web and now you want to implement it on your own website. I’ll show you how to do just this using a little snippet of code that will allow you to add a dynamic Facebook “like” button to any page on your website!

Implement a dynamic Facebook Like button

Read the rest of this article »

How to Setup XAMPP WordPress Virtual Hosts

   Posted: July 6th, 2010    By: Devin Walker   

I like to develop in a localized environment where I have to do minimal setup and configuration on the remote server when it’s time to go live. Working with WordPress makes it very easy to do this and it’s a breeze to setup with virtual hosts and the free XAMPP stack.

Why do this? It makes it very easy to move over the WordPress database when it’s time to go live. Developing locally is always in your best interest. This method is preferred over ‘going commando’ because you can keep better control over your code and it’s faster to develop. Plus a whole slew of other reasons that you can Google if you feel like it. Let’s get started on setting up your WordPress install to use XAMPP’s virtual hosting capabilities.

Read the rest of this article »

Use JavaScript to Print an Image

   Posted: July 1st, 2010    By: Devin Walker   

Using JavaScript you can have images print when clicked on. What this script will do for you is open whatever image is specified in the JavaScript in a new browser window along with the Print options window.

This method is useful if you are looking for a way to have either a print button for a specific image on a page. Please refer to the demo to see exactly how this can be accomplished. Remember to specify the image’s width and height in the JavaScript onClick event.

Read the rest of this article »

WordPress Heirarchical Sidebar Page Menus

   Posted: June 14th, 2010    By: Devin Walker   
Let's say you want to show a hierarchical sidebar menu that displays a listing of current subpages. This is easy enough, but let's say that you have a top menu that shows all top-level pages. Once you click on a top level page from that menu it will take you there and in the sidebar show all subsequent child pages. Now what if those child pages have a child? You don't want all menu items to disappear when you click on one of those child pages. That just looks funny. Here's the bit of code that works great for me:
<?php 
if ((count($post->ancestors) > 0) 
        && ($data = array_reverse($post->ancestors)) 
        && !is_null($data[0])){ 
	$data = wp_list_pages('title_li=&echo=0&child_of='.$data[0]); 
} else { 
        $data = wp_list_pages('title_li=&echo=0&child_of='.$post->ID); 	
} 
if (strlen($data) != '') {?>
          <ul class='nav'><?php echo  $data; ?></ul>	
<?php } ?>

2 comments

Posted in PHP,Wordpress

Tagged with

WordPress Alternating Classes

   Posted: June 5th, 2010    By: Devin Walker   

It's often very useful to have alternating classes in for styling purposes. Let's say you want every other row to be a darker shading, this is very common and I'll show you how to implement this in WordPress using a simple bit of code.

For my example here I will show you how to create alternating classes for use with the WordPress loop. This way, when the loop pulls your posts from the db every post container will have a separate class name up to as many as we define in our array. This method of alternating classes in WordPress will work for wherever you have a loop. Therefore, your comments, categories, tags, etc. can all be styled up using this method. Pretty cool huh? Let's see how this is done.

Read the rest of this article »

Leave a comment!

Posted in Wordpress

Tagged with ,