Archive

Archive for February, 2012

Quick Tip: Writing Simple Modular Code

February 29th, 2012 Comments off

In my last article, we learned a new way to use Bitly URLs in WordPress. In most of these cases we usually edit our functions.php file. Today we’ll learn a new method for how we can keep our functions.php file nice and clean by using a modular approach.

In this tutorial you’ll learn how you can make very simple modular code. It will be simple code, and because it is modular you have to implement it manually. Why use modular code anyway? Basically modular code is a part of your WordPress theme’s files which you can install and uninstall and can work with many themes. So if you change your theme but still want your custom functions with your new theme, this method will come in handy.


Motivation

Initially, it’s likely that you might think to yourself, “why should I bother doing this?”, and, “what good will it do?”. This is what drives away most people from taking up this modular approach, but be patient, the results will be reaped in future. If you develop themes, then you may know this method already but if you are starting out, this trick will help you save time copying and pasting functions again and again.


Example 1

We will be writing a simple function and will see how we can incorporate this file in our theme’s functions.php


Step 1.1

So lets write a new function. This code is in PHP so we’ll be enclosing it the way we usually do for a standard PHP function.

 __( 'Primary Menu' ),
			'secondary-menu' => __( 'Secondary Menu' )
		)
	);

?>

As you can see this is just a standard function for registering the menus. Copy the above code and paste it into your text editor of choice and save it as my-modular-code.php


Step 1.2

Save this file along with your WordPress theme files, or you can save it in a sub-folder if you like. I would suggest saving this file in a sub-folder, so when you change your theme you can copy the folder with all your custom functions, which will help portability.

Go ahead and open your theme’s functions file, usually named functions.php, and paste this line of code just after the opening PHP tag:

include_once('path/to/my-modular-code.php');

This line of code will access your my-modular-code.php file and will run the code within when this command is executed. This trick helps keep your functions.php file clean and easy to navigate.


Example 2

Let us do a similar example. Assume that you want to add shortcode functionality to your blog. For this we usually tend to copy all the code into our functions.php file, which is not necessarily bad. But as time progresses you will have an overflowing functions file. So to avoid that we’ll use the same modular approach.


Step 2.1

Copy the code below which is simple and straight forward, and save it as my-shortcode.php into the same sub-folder as the previous file.

function bold( $atts, $content = null )

	return ''.$content.'';

add_shortcode('bold', 'bold');

The code is very simple and it will just bold the characters when the text is enclosed within [bold][/bold] tags.


Step 2.2 Calling the my-shortcode.php File in functions.php

Now open up your functions.php file and paste the same code as we did in our first example, only replacing the file name:

include_once('path/to/my-shortcode.php');

When the function file reaches this line of code it will go to the my-shortcode.php file and will include all the code which is residing within it!


Conclusion

As we learned earlier, this method helps in keeping our functions file nice and clean. Other than that it will help portability when changing themes. You could easily change your theme without scouring through your old functions file to find your custom shortcodes and snippets. This saves a lot of time and prevents headaches! I remember when I made a theme for my own blog, the functions file reached a whopping 1500 lines, and if you want to find a small bit of code it’s almost certain that you will end up making a mistake.

This is also a good introduction to making a plugin. In other words this is sort of like the simplest plugin you could make. This will help you in understanding and writing your own plugins in future. I hope that it has increased your knowledge. In the next tutorial we’ll use the same modular approach and write a cool Facebook-like widget.

Have fun trying the code and do let us know if you need any kind of assistance, just leave your comments below and we’ll try to help or troubleshoot your problems. Thanks for reading!

Original from: http://wp.tutsplus.com/tutorials/theme-development/quick-tip-writing-simple-modular-code/

40 Examples of Brilliant Responsive Website Layouts

February 29th, 2012 Comments off

Responsive web design become a very popular trend in 2011. It’s likely something we’ll see continuing well into 2012 as designers are beginning to support a myriad of mobile devices. Building layouts for the web can be tough, but inspiration is a huge factor.

In this gallery I’ve collected 40+ amazing responsive website layouts. These designs are built to support a set of different resolutions and re-size accordingly. It’s tricky building this functionality in HTML5, even advanced web developers may not understand responsive design trends. But check out some of our examples below and you’ll pick up techniques very quickly. Additionally let us know your thoughts or questions in the post discussion area.

Fork CMS

Full View:

Mobile View:

SimpleBits

Full View:

Mobile View:

White Lotus Aromatics

Full View:

Mobile View:

1140px CSS Grid

Full View:

Mobile View:

Atlason

Full View:

Mobile View:

10K Apart

Full View:

Mobile View:

Cognition

Full View:

Mobile View:

Reverse Buro

Full View:

Mobile View:

Sunday Best

Full View:

Mobile View:

Dustin Senos

Full View:

Mobile View:

Clear Air Challenge

Full View:

Mobile View:

Owltastic

Full View:

Mobile View:

320 and up

Full View:

Mobile View:

Yaron Schoen

Full View:

Mobile View:

Build Guild

Full View:

Mobile View:

Do Lectures

Full View:

Mobile View:

Trent Walton

Full View:

Mobile View:

Food Sense

Full View:

Mobile View:

Sparkbox

Full View:

Mobile View:

ribot

Full View:

Mobile View:

Sweet Hat Club

Full View:

Mobile View:

A Different Design

Full View:

Mobile View:

Teixido

Full View:

Mobile View:

Sasquatch Music Festival

Full View:

Mobile View:

Electric Pulp

Full View:

Mobile View:

Stephen Caver

Full View:

Mobile View:

Social Marketer’s Summit

Full View:

Mobile View:

Sleepstreet

Full View:

Mobile View:

Porcupine

Full View:

Mobile View:

Interim

Full View:

Mobile View:

Tileables

Full View:

Mobile View:

CalebAcuity

Full View:

Mobile View:

Simon Collison

Full View:

Mobile View:

Spigot Design

Full View:

Mobile View:

Forefathers Group

Full View:

Mobile View:

Deren Keskin

Full View:

Mobile View:

Robot… Or Not?

Full View:

Mobile View:

Arrrcamp Conference

Full View:

Mobile View:

Thirst Studios

Full View:

Mobile View:

Visua Design

Full View:

Mobile View:

Made by Splendid

Full View:

Mobile View:

Five Simple Steps

Full View:

Mobile View:

Ryan O’Rourke

Full View:

Mobile View:

dConstruct 2011

Full View:

Mobile View:

Diablo Media

Full View:

Mobile View:

Asbury Agile Web Conference

Full View:

Mobile View:

You might also like…

15 Free WordPress Themes with a Responsive Layout →
25 jQuery Plugins to help with Responsive Layouts →
15 Responsive CSS Frameworks Worth Considering →
10 HTML5-Ready Blank, Bare-Bones and Naked Themes for WordPress →



Original from: http://feedproxy.google.com/~r/speckboy-design-magazine/~3/4IPRHQdtYCg/

The Complete Guide To The WordPress Settings API, Part 2: Sections, Fields, and Settings

February 28th, 2012 Comments off

This entry is part 2 of 2 in the series The Complete Guide To The WordPress Settings API

When it comes to developing WordPress Themes and Plugins, there are a number of different ways developers are creating their menus, options, and validation functionality. The thing is, there’s really only one way to properly do this within WordPress: the Settings API.

This series is aiming to be the definitive guide for how to take advantage of the WordPress Settings API so that you have a single point of reference for properly developing your themes and plugins.

In the first article in this series we took a broad look at the Settings API and why it matters. Here, we’re going to begin diving into the API and how to take advantage of everything that it offers.

We’ll take a look at the foundational units of WordPress options – sections, fields, and settings – and how to include them in the native WordPress Dashboard.


On Sections, Fields, and Settings

Before we get into writing any code, it’s important to understand the three main components of the WordPress Settings API.

  1. Fields are individual options that appear on menu pages. Fields correspond to actual elements on the screen. That is, a field is managed by a text box, radio button, checkbox, etc. Fields represent a value stored in the WordPress database.
  2. Sections are a logical grouping of fields. Whenever you’re working with multiple fields, you’re likely going to be grouping related options together – Sections represent this grouping. Furthermore, if your work includes multiple administration pages, each section often corresponds to its own menu page (though you can also add them to existing sections).
  3. Settings are registered after you’ve defined both Fields and Sections. Think of Settings as a combination of the Field and the Section to which it belongs.

At this point, don’t worry if you’re still unclear about any of the major components. We’re going to take an in-depth look at each component along with example source code that ties it all together.


A Sandbox for Our Settings

In order to get started programming against the Settings API, let’s setup a basic theme that can be used throughout this article and the rest of the series. All of the source code is available on GitHub, too.

In your local installation of WordPress, navigate to the “themes” directory and create a new, empty directory and call it “WordPress-Settings-Sandbox.” Add the following three files:

  • style.css – This is the stylesheet for the theme. It includes all meta information for the theme. It’s required by WordPress
  • index.php – This is the default template for the theme. It can be empty at first. It’s required by WordPress
  • functions.php – This is where we’ll be doing most of our work. We’ll be filling this out throughout the tutorial

Add the following code to style.css:

/*
Theme Name: WordPress Settings Sandbox
Theme URI: YOUR URI
Description: A simple theme used to showcase the WordPress Settings API.
Author: YOUR NAME
Author URI: YOUR WEBSITE
Version: 0.1

License:

 Copyright 2012 YOUR NAME (YOUR EMAIL ADDRESS)

  This program is free software; you can redistribute it and/or modify
  it under the terms of the GNU General Public License, version 2, as
  published by the Free Software Foundation.

  This program is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  GNU General Public License for more details.

  You should have received a copy of the GNU General Public License
  along with this program; if not, write to the Free Software
  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA

*/

Next, add the following code to index.php:



	
		
	
	

		

		

This is theme content.

Note that the above markup is extraordinarily simple and I do not recommend using this as a foundation for theme development. It’s tailored for this series of articles and is simply providing the means by which we will be reading values from the Settings API.

In the Themes administration screen, refresh the page and you should see the new Sandbox theme appear. Go ahead and activate it.

Theme Selection

At this point, we’re ready to get started.


Our First Set of Options

Notice in the index template above, we’ve defined three specific content regions: header, content, and footer. Using the Settings API, let’s create a “General” section containing three fields, each of which corresponds to one of the specific content regions we’ve just defined.

Before writing any code, I always find it helpful to list out exactly what I need to do. In this case, we need to do the following:

  • Define a section that will be used to group each field
  • Add three fields – one for each content region – to the section defined above
  • Register the settings with the WordPress API.

In order to avoid any massive blocks of code and to make sure that we’re covering all of our bases, we’ll be taking each of the above items point by point.

Creating the Section

In order to find our “General” section of options, we’re going to need to use the add_settings_section function of the Settings API. According to the WordPress Codex, add_settings_section requires three arguments:

  • ID – This is the unique identifier for this particular section. Note that this is the value that will be used to register each field within this section. Feel free to name it whatever you want, but I recommend making it clear for the sake of readability.
  • Title – This value will be displayed at the top of the page in the WordPress Dashboard when users are working with your options.
  • Callback – This is the name of a function that we’ll define that will render text on the screen for the function. It can be used for a variety of functionality. In the simplest case, it can be used to provide a set of instructions or description for your option page.
  • Page – This value is used to tell WordPress on which page your options should be displayed. In a future article, we’ll use this to add options to our own custom pages. For now, we’ll be adding this to the existing General Options page.

With that, let’s go ahead and define our section. Take a look at the following, commented code. We’re adding this to our functions.php file.

A word about the code snippets in this series: don’t simply copy and paste this code. Take time to read each line, see how the arguments correspond with each API function that we cover, and follow the corresponding comments to make sure you get the hang of what we’re doing:

Select which areas of content you wish to display.

'; // end sandbox_general_options_callback ?>

Make sense? Generally speaking, it doesn’t look like much but navigate to your Settings menu and click on General. Scroll to the bottom of the page and you should see your new section of options.

General Settings

You can add this section to any of the pages under the Settings menu. In the above example, we’ve passed “general” as the last parameter to the add_settings_section, but if you’d like to add it to a different page, you can provide a different page title. Here’s a reference for each of the Settings pages and their corresponding key:

  • General, “general”
  • Writing, “writing”
  • Reading, “reading”
  • Discussion, “discussion”
  • Media, “media”
  • Privacy, “privacy”
  • Permalinks, “permalink”

Adding Fields

Now that we have a section defined, we can introduce a few options. Recall that in our index template we defined three specific container elements: header, content, and footer.

Though we’ll be introducing more options throughout the course of this series, today we’re going to introduce a way to toggle the visibility of each of the above elements.

Similar to what we did with the settings section, I like to list out exactly what we need to do before writing any code. Since we’re going to be toggling each of the content areas…

  • We’re going to need three options – one for each area of content
  • Since we’re toggling visibility, we can use a checkbox as our interface element

At this point, we’re ready to introduce the first settings field. To do this, we’ll use the add_settings_field function. This function takes six parameters (four required, two optional). They are as follows:

  • ID – The ID of the actual field. This will be used to save and retrieve the value throughout the theme. I recommend naming this something meaningful for improving readability of your code.
  • Title – This value applies a title to the field option on the administration page. This should be clear as it will be read by end users.
  • Callback – This is the name of the function that is used to render the actual interface element with which users will interact.
  • Page – Similar to the section we outlined, this parameter identifies on which page this option should reside. If you’re only introducing a single option, you can add it to an existing page rather than a section that you’ve defined.
  • Section – This refers to the section that you’ve created using the add_settings_section function. This value is the ID that you specified when creating your section. This is an optional parameter.
  • Arguments – This is an array of arguments that are passed to the callback function. This is useful if there is additional information that you want to include in rendering your option element. This is an optional parameter.

With that said, let’s go ahead and define our first setting field. Specifically, we’ll be introducing an option to toggle the visibility of the header.

First, we make a call to add_settings_field just below the add_settings_section function call in the initialization function we wrote in the first part of the tutorial. Review each line and the comments for each option:

// Next, we will introduce the fields for toggling the visibility of content elements.
add_settings_field(
	'show_header',						// ID used to identify the field throughout the theme
	'Header',							// The label to the left of the option interface element
	'sandbox_toggle_header_callback',	// The name of the function responsible for rendering the option interface
	'general',							// The page on which this option will be displayed
	'general_settings_section',			// The name of the section to which this field belongs
	array(								// The array of arguments to pass to the callback. In this case, just a description.
		'Activate this setting to display the header.'
	)
);

Next, we define the callback referred to in the above function. This callback is used to render the checkbox and the description on the administration page:

/**
 * This function renders the interface elements for toggling the visibility of the header element.
 *
 * It accepts an array of arguments and expects the first element in the array to be the description
 * to be displayed next to the checkbox.
 */
function sandbox_toggle_header_callback($args) 

	// Note the ID and the name attribute of the element should match that of the ID in the call to add_settings_field
	$html = '';

	// Here, we will take the first argument of the array and add it to a label next to the checkbox
	$html .= '';

	echo $html;

 // end sandbox_toggle_header_callback

As far as the checkbox is concerned, pay attention to the comments, but don’t worry too much about some of the attributes that you don’t recognize (such as a call to the checked() function). Later in this series, we’re going to take a look at each input element and their corresponding helper functions.

By now, your functions.php file should look like this:

Select which areas of content you wish to display.

'; // end sandbox_general_options_callback /* ------------------------------------------------------------------------ * * Field Callbacks * ------------------------------------------------------------------------ */ /** * This function renders the interface elements for toggling the visibility of the header element. * * It accepts an array of arguments and expects the first element in the array to be the description * to be displayed next to the checkbox. */ function sandbox_toggle_header_callback($args) // Note the ID and the name attribute of the element match that of the ID in the call to add_settings_field $html = ''; // Here, we will take the first argument of the array and add it to a label next to the checkbox $html .= ''; echo $html; // end sandbox_toggle_header_callback ?>

At this point, refresh the General Settings page. You should see your checkbox with the “Header” label and a description beside the checkbox.

First Option

Unfortunately, it’s not actually saving the value to the database yet.

Registering Our Settings

In order to get our fields to actually save to the database, we need to register them with WordPress. Doing this is relatively easy – we just need to take advantage of the register_setting function.

This function accepts three arguments (two required, one optional):

  • Option Group – This is actually the name of the page (not the ID of the section) that we specified when creating our settings section. This argument is required.
  • Option Name – This is the ID of the field that we’re registering. In our case, we’re only registering a single field, but if we were registering multiple fields, then we’d need to call this function for each field we’re registering. We’ll see more on this in a moment. This argument is required.
  • Callback – This argument requires the name of a function that will be called prior to saving the data to the database. This argument is outside the scope of this article but we’ll be visiting it before the series is over. This argument is optional.

At this point, let’s register the setting that we’ve just created. Take a look at the code below. Add this line of code directly below the call to add_settings_field in the initialize function we defined earlier in the article. It’s arguably the easiest to follow out of all of the snippets in this article:

// Finally, we register the fields with WordPress
register_setting(
	'general',
	'show_header'
);

Try it out – check the checkbox, click on ‘Save Changes,’ and notice that when the page refreshes, the option has changed. Uncheck the checkbox, save, and watch it save.

Saved Option

Easy enough, right?

Adding the Final Two Options

We still need to introduce the options for toggling the visibility of the content area and the footer area. It’s almost exactly the same as how we setup the option for toggling the header.

First, let’s define the field for displaying the content area. This will go under the first call to add_settings_field:

add_settings_field(
	'show_content',
	'Content',
	'sandbox_toggle_content_callback',
	'general',
	'general_settings_section',
	array(
		'Activate this setting to display the content.'
	)
);

And let’s setup the callback function:

function sandbox_toggle_content_callback($args) 

	$html = '';
	$html .= ''; 

	echo $html;

 // end sandbox_toggle_content_callback

Next, let’s define the field for displaying the footer area:

add_settings_field(
	'show_footer',
	'Footer',
	'sandbox_toggle_footer_callback',
	'general',
	'general_settings_section',
	array(
		'Activate this setting to display the footer.'
	)
);

And setup the callback for this field, too:

function sandbox_toggle_footer_callback($args) 

	$html = '';
	$html .= ''; 

	echo $html;

 // end sandbox_toggle_footer_callback

Finally, let’s register these two new fields with WordPress. These two function calls go at the bottom of the initialize function we defined earlier in the article.

register_setting(
	'general',
	'show_content'
);

register_setting(
	'general',
	'show_footer'
);

The final version of functions.php should look like this:

Select which areas of content you wish to display.

'; // end sandbox_general_options_callback /* ------------------------------------------------------------------------ * * Field Callbacks * ------------------------------------------------------------------------ */ /** * This function renders the interface elements for toggling the visibility of the header element. * * It accepts an array of arguments and expects the first element in the array to be the description * to be displayed next to the checkbox. */ function sandbox_toggle_header_callback($args) // Note the ID and the name attribute of the element match that of the ID in the call to add_settings_field $html = ''; // Here, we will take the first argument of the array and add it to a label next to the checkbox $html .= ''; echo $html; // end sandbox_toggle_header_callback function sandbox_toggle_content_callback($args) $html = ''; $html .= ''; echo $html; // end sandbox_toggle_content_callback function sandbox_toggle_footer_callback($args) $html = ''; $html .= ''; echo $html; // end sandbox_toggle_footer_callback ?>

Now refresh the General Settings page and notice you have all three fully functional checkboxes.

Final Options

Reading the API

What good are options if we can’t take advantage of them throughout our theme or our plugin? We need to be able to read the values in order to properly manage our new options.

To do this, we need to use the get_option function. This function accepts two arguments (one required, one optional):

  • Option ID – This argument is the ID of the field for the value you’re attempting to retrieve. This argument is required.
  • Default Option – This is the value the function will return if the function returns an empty value (such as in the case that the option is not found in the database). This argument is optional.

First, let’s try to toggle the visibility of the header. In the index template that we created earlier in this article, locate the element with the ID of header. It should look like this:


Next, let’s make a call to get_option in the context of a conditional. If the conditional evaluates to true (that is, the option has been checked on the General Settings page), then the element will be displayed; otherwise, the element will not display.


	

After that, hope over to the General Settings page, check the option for hiding the header element, and refresh your homepage. The header element should no longer appear.

At this point, it’s a simple matter of repeating the process for the content and footer element, too. We need to wrap the content and footer elements with conditionals that evaluate the result of get_option calls.

Take a look:


	

This is theme content.

Revisit the General Settings page, toggle each checkbox, and refresh the theme page. Your elements should each toggle independently of one another.


Next Up, Menu Pages

That’s it, for now! We’ve taken a look at all of the functions required for introducing new sections, fields, and settings into WordPress. Of course, there’s much more to cover.

In the next article, we’ll take a look at how to add custom menu items to the WordPress menu, and how we can introduce our own pages to the WordPress Dashboard.


Related Resources

We covered a lot of material in this article. Here’s a reference for everything that we used throughout this article.

Original from: http://wp.tutsplus.com/tutorials/the-complete-guide-to-the-wordpress-settings-api-part-2-sections-fields-and-settings/

Bringing the Membership Process to the Front of Your Site

February 27th, 2012 Comments off

WordPress ships with the ability to add users, either manually or via registration. This includes the ability to assign various roles and capabilities. But more often than not you don’t want users to be exposed to the WordPress backend. In this tutorial I’ll show you how to create a custom registration form on the front of your site as well as a custom profile form. Users will also receive custom emails with each step of the registration process. Please note, this tutorial won’t be covering membership payments.


Some Background & What We’ll Be Covering

We’ll be using the TwentyEleven theme where we’ll be editing the functions.php and the header.php. Some people might prefer to use BuddyPress for a task like this, and that’s cool, but I feel like why have all those features if you’re not going to use them.

This is what we’ll be doing

  • Installing required plugins
  • Configuring plugins
  • Adapting our menus
  • Creating a custom profile page
  • Creating a custom registration page
  • Creating custom emails for each stage of the registration process

It’s kind of a lengthy process so grab a coffee or beer and knuckle down.


Step 1 Get the Plugins

Okay so first things first, let’s get the plugins we need. I’ll be adding them using the WordPress interface but if you’d prefer you can use the links below to download and install them manually.

Get the Plugins


Step 2 Configure

“Make sure you have ‘Anyone can register’ ticked under General Settings”

Time to configure our plugins, but before that though make sure you have Anyone can register ticked under Settings -> General.

Okay, now onto the plugin configuration, lets start with:

Theme My Login – Basic Setup

Theme My Login creates a “login/logout” page once installed and by default it adds it to your pagelist. For more control let’s set it up manually:

  1. Go to Settings -> Theme My Login and untick the option “Show in Pagelist”
  2. Click “Save Changes”
  3. Navigate to Appearance -> Menus and add it to your menu (if your theme supports more than one menu you can put it anywhere)*

*Not sure how to use the menu? Read here

Alright – so now if you jump to the front of your website you’ll notice you have a login/logout menu item. It should say “Log Out” as you are logged in. Nice one!

But let’s say you don’t want it in your menu? No problem, you can remove it from your menu and add it as a widget. Luckily Jeff Farthing (creator of the plugin) has included a nifty widget with loads of options. They are all pretty self-explanatory so I won’t go through it. Just head to Appearance -> Widgets and drag the Theme My Login widget to the desired widget area. I prefer it in my menu, but you could have both.

Now lets set up some of the modules.

Theme My Login – Modules Setup

Jump back to Settings -> Theme My Login -> Modules and enable the following:

  • Enable Custom E-mail
  • Enable Custom Redirection
  • Enable Security
  • Enable Themed Profiles
  • Enable User Moderation

Great. Now let’s configure those modules starting with E-mail. Basically you are required to create custom email content for each phase of the membership process (New User, Retrieve Password, Reset Password, User Activation, User Approval, User Denial). Obviously this is up to you what you write, but make sure:

  • For the “From E-mail” use something like no-reply@yourdomain.com
  • You’ll want the “E-mail Format” to be Plain Text.

It’s a good idea to make use of the email variables – %user_login%, %user_email%, %user_pass% – but don’t worry too much about nutting it out perfectly right now. We’ll be sending a few tests so you can polish it later.

Okay ready for some Redirection magic? As Administrator you’ll still want to be taken to the backend/dashboard when you login so you’ll want to leave the Administrator role as is (Don’t lock yourself out). I want my users to be taken to their profile when they login so I’m going to change all the other roles. So for “Log in”:

  • Use the “custom location” option and enter something like http://yourdomain/profile
    (assuming your permalink structure is /%category%/%postname%/)

and for “Log out”:

  • I’m putting “Referer”. That way when users log out they stay on the page they were on.

For Security I’m just going to leave as is, but it’s worth having a look to see if those settings suit you. Finally Moderation. As we are running a free-to-join site, choose E-mail Confirmation for User Moderation.

Okay let’s apply some profile goodness.

Theme My Profile

We are going to need a page to house our user profile in so head over to Pages -> Add New. Give your page a title, something like “Profile”, and paste this shortcode [theme-my-profile] into the content (make sure you’re in the HTML edit mode). Take note of the page ID and publish.

Go to Settings -> Theme My Profile. Apply these settings but please be careful not to lock yourself out of the backend:

  1. Enter the page ID of the newly created “Profile” page
  2. Make sure Show in Pagelist “Never” is selected (we’re using WP 3 Menus)
  3. Use theme-my-profile.css is ticked.
  4. For the template settings check out the image below:

Save the changes.


Step 3 Setting Up the Menus

Basically we will be using two menus: one for signed-in users, and one for signed-out users or non-members. So open your FTP program and download header.php from your theme. We want to add an if statement to the code that sets up the menu. It’s line 118 if you are using TwentyEleven.

Replace this:

	 'primary' ) ); ?>

With this:

	  
           'user-menu', 'items_wrap' => '', 'container_class' => 'menu-menu-container' ) );?> 
      
           'main-menu', 'items_wrap' => '', 'container_class' => 'menu-menu-container' ) );?> 
      

If you’d like to, you can read more about wp_nav_menu in the WordPress Codex.

Okay now get the functions.php file and change line 101 in the header.php to reflect the updates.

Replace this:

	register_nav_menu( 'primary', __( 'Primary Menu', 'twentyeleven' ) );

With this:

	register_nav_menus(
			array(
				'main-menu' => __( 'Main Menu' ),
				'user-menu' => __( 'User Menu' ),
			)
		);

Now upload those files to your theme directory and jump to the WordPress backend. Let’s set up the menus, go to Appearance -> Menus. You should now have two menus available to you: “main menu” and “user menu”, activate both.

  • Under main menu have “Login” page
  • Under user menu have “Login” and “Profile” pages

Save the changes and let’s get into some custom email templates.


Step 4 WP Better Emails – Setup

Alrighty time to get some custom emails happening so jump to Settings -> WP Better Emails. For the “Name” and “Email address” inputs use something like Blog Name and no-reply@yourdomain.com. Okay great, now scroll down and send yourself a preview. Hop over to your email client and you should have a pretty nice looking email waiting for you. Not bad but lets customise it a little. Jump back to WordPress and copy all that HTML and paste it into your favourite text editor. It’s really up to you how much you want to edit this. Let’s keep it simple and just change the logo. So create an image 500px wide by 100px heigh. Upload it to your server and copy the path.

On line 22 in the HTML replace the %blog_name% with your image, something like this:

	

Now send yourself another test and you should have something like this:


Step 5 Custom Registration Page

Things are taking shape, but you have use the register link under the login form to register. Bummer. I want the “register” to be part of my menu. So head over to Appearance -> Menus and add a new menu item to the “main menu” using the “Custom Links” panel. I’ve called mine “Sign up” and the URL is http://yourdomain.com/login?action=register (assuming your permalinks are set to%category%/%postname%).

Great so now we have a “sign-up” tab that takes people to the registration page. Nice right? But let’s say you want to include some custom fields? Like first name, website and postcode.

Theme My Login ships with some template forms. So you can can download the forms wp-content -> plugins -> theme-my-login -> templates and edit them and upload to your theme directory. But let’s do it using our functions.php. So download your functions.php and paste this after all the existing code.

/*-----------------------------------------------------------------------------------*/
/*	Adding required fields to the registration page
/*-----------------------------------------------------------------------------------*/	

	add_action('register_form','show_this');
	add_action('register_post','check_fields',10,3);
	add_action('user_register', 'register_extra_fields');

	function show_this()
	
	?>
		

add( 'empty_realname', "ERROR: Please enter the name of your first name" ); else $website = $_POST['first_name']; global $website; if ( $_POST['website'] == '' ) $errors->add( 'empty_realname', "ERROR: Please enter the name of your website" ); else $website = $_POST['website']; global $postcode; if ( $_POST['postcode'] == '' ) $errors->add( 'empty_realname', "ERROR: Please enter your postcode" ); else $postcode = $_POST['postcode']; } function register_extra_fields ( $user_id, $password = "", $meta = array() ) update_user_meta( $user_id, 'first_name', $_POST['first_name'] ); update_user_meta( $user_id, 'website', $_POST['website'] ); update_user_meta( $user_id, 'postcode', $_POST['postcode'] );

Okay so you might want to edit that to suit you. Here’s a basic breakdown:

  • The first function ( show_this ) says insert the following fields into the form
  • The second function ( check_fields ) checks if the fields are filled in and spits out errors if necessary (basic validation)
  • The third function ( register_extra_fields ) updates the user’s data – as well as the user’s profile

And for a bonus let’s change the word “register” to “join”:

/*-----------------------------------------------------------------------------------*/
/*	Change 'register' to 'join'
/*-----------------------------------------------------------------------------------*/	

	function tml_title_filter( $title, $action ) 
	if ( $action == 'register' )
		return __( 'join' );
	return $title;
	
	add_filter( 'tml_title', 'tml_title_filter', 10, 2 );

Step 6 Custom Profile Page

Like most people it baffles me why WordPress has stuff like AIM and Jabber in the profile fields… so lets get rid of them! Paste the following code under your current functions.php code.

/*-----------------------------------------------------------------------------------*/
/*	Reomve feilds from profile
/*-----------------------------------------------------------------------------------*/
	function extra_contact_info($contactmethods) 
		unset($contactmethods['aim']);
		unset($contactmethods['yim']);
		unset($contactmethods['jabber']);

		$contactmethods['postcode'] = 'Post code (required)';

		return $contactmethods;
	
	add_filter('user_contactmethods', 'extra_contact_info');

Step 7 Test & Style

Alright, alright alright! (Kevin Hart style) Let’s test this! Logout of WordPress and hop to the front of your site. Click “sign-up” and go through the process.

Take note of any changes you need to make, for example, email template messages, etc. then apply them and re-test until you are happy.

Now you might want to style it up a bit, and luckily it’s easy using some appropriately named stylesheets uploaded to your theme directory. You can download these to get you started using the “Download Source Files” link at the top of this tutorial.

Using these style sheets will make sure your CSS isn’t overwritten when your theme updates.


Step 8 One More Thing

One last thing, the admin bar, let’s banish it for good. Add the code below to your functions.php.

/*-----------------------------------------------------------------------------------*/
/*   Disable admin bar for all
/*-----------------------------------------------------------------------------------*/
show_admin_bar(false);

Conclusion

So you can see it’s pretty easy to pull the membership process to the front of your website. This method is extremely flexible, the plugin configuration used in this tutorial may differ to suit your needs. It’s also fairly easy to have member specific content (try using wp-members). I’ve had success using this in commercial projects.

Please leave any feedback, or if you have suggestions I’d love to hear them, in the comments below.

Original from: http://wp.tutsplus.com/tutorials/creative-coding/bringing-the-membership-process-to-the-front-of-your-site/

Things I Hate about My Clients

February 27th, 2012 Comments off

In the Things My Clients Hate. What about Yours? article I discussed 5 things my clients hate. Now, let me present the other side of the story – i.e. 5 things I hate about clients. Well, with so much hatred, it might sound like we freelancers and clients are at a war but definitely I don’t think this is the case.

Rather, I hope that by giving my opinion and hearing yours, too, we will be able to understand each other better and work more smoothly together. What is more, very often the same person is a contractor on a project and a client on another project, so roles change pretty frequently, which is good because it is easier to walk in the other party’s shoes.

1. “I Don’t Know What I Want (but I Want It Asap)”

I am perfectly aware there are unpredictable circumstances and urgent things and that a project’s scope can change. I am fine with that but problems start when emergency and unclarity become the norm. In theory, a sequence of emergencies could be bad luck but in practice in 99 per cent of the cases it is just poor planning.

Image credit: Brainloc

It is especially irritating when I have spent a lot of time waiting for instructions what to do, or even worse – working on what we have decided last and then all of a sudden the client decides he or she doesn’t want what we have initially agreed upon last but wants something really different instead and guess what – wants it asap!

I have noticed that even if the scope is fixed in stone in the contract, such clients do try to overturn the previous agreement. Sometimes when I tell them I find this unacceptable, they stop but if they don’t basically, with such clients, I have only one project, if I manage to stand a whole project at all because they are just a waste of time for me.

2. “$10 for 10 Hours of Hard Work Is Quite OK, Right? And There Is More Work for You”

We all have budgets to deal with and to live within and I know not all projects pay well but sometimes what the client is asking for is just too much. I had this problem more frequently when I was active at bidding sites but unfortunately clients like this can be found elsewhere. For instance, once a client approached me with a writing assignment that was paying like $1-1.5 per hour, which meant that even if I worked 10 hours a day on this project, this is less than what I need to pay a day for rent, utilities, food, etc.

Image credit: michaelaw

I rejected the project because I simply couldn’t even think of working at such low rates but even if I could afford it, I wouldn’t take it – I have better ways to kill the time and exhaust myself.

Clients with such ridiculously low rates often use the bait that they might be paying not much (i.e. not even peanuts but rotten peanuts) but they can offer a steady supply of work. Oh, what an honor! I am craving to work for $10 a day for the next two years for sure.

Such clients are not only stingy but they also don’t know how to run a business. For instance, for these articles that would have earned me $1-1.5 per hour from the client, it was quite possible I could earn more from them in just one month or two by publishing them online at a revenue sharing site, for example.

Well, it would have required some promotion in addition to writing, which is even more work for the same handful of peanuts but if I ever took the trouble to work on such a low paying project, I wouldn’t do it for somebody who either doesn’t know how to run a business profitably, or who wants to pay next to nothing for all the hard work I will put in. No, thanks, neither is an option for me!

3. “WE Are Late with the Project!!!” (and We Are Twisting Arms)

Deadlines are to be adhered to but how about avoiding rush because of lack of communication? I really hate it when there is a rush because I got the task approved in the last minute and/or my emails got answered on the third week, and now WE are late with the project.

When I was new to freelancing, I once had a client who changed the tasks multiple times and for one of the multiple deadlines (an urgent one, of course, as all of them were), I didn’t sleep for two days just to finish the task on time. Now I wouldn’t make such sacrifices, even if the world will end but then I was young and unexperienced.

After I submitted the deliverable, I was barely alive because of the lack of sleep. This was appreciated – by serving me another urgent task and by threatening me that if WE missed that deadline, I wouldn’t get paid for the whole project.

Needless to say, this attempt at twisting my arms didn’t pass. I threatened back that if I didn’t get paid for the project, I would sell the deliverables to another client for more money and I would make his life difficult in many other ways. I don’t think mutual threats are the way to work professionally but with some people you just can’t afford to play it nice.

Image credit: maurodifm

We somehow managed to finish the project without killing each other but I learned the lesson that working with brainless dictators is the last thing I want from then on, no matter if they pay top dollar or not. I guess some clients are used to extorting freelancers by using force or maybe holding them at gunpoint but for me this simply isn’t the way to work.

4. “It’s a Small Task, Just a Few Quick Changes”

I do love change and I do love making things perfect but sometimes the seemingly small thing just shouldn’t be changed. There are small things and small things. The small thing that when slightly modified turns everything upside down shouldn’t be touched at all because it drags tons of changes as a consequence. The small cosmetic changes are always welcome, if they are making things better but very often a seemingly small change is neither possible, nor feasible. Still, there are clients who don’t get it and they always insist on making a change regardless of what it takes.

A variety of the small changes task is the quick updates one. Sometimes it is really a quick updates task that takes less than an hour but in other cases it is starting from scratch that takes a couple of days. A couple of years ago an old client of mine asked me to update the site I had designed for her in the past. It didn’t look hard till the moment I saw what I was up to. After I had finished the site, her daughter who had no idea of web design whatsoever, had been updating it occasionally till the moment the mess was so thick that the poor kid was absolutely helpless.

Image Credit: doctor_bob

Updating the site wouldn’t have been such a problem, if she hadn’t edited my carefully crafted and cleaned HTML in FrontPage, Word, or who knows what. I guess you can imagine the mess I found – tables inserted here and there, rows and columns merged and split randomly, bogus tags and attributes, etc. I couldn’t use my old files because the content was outdated and I couldn’t use her daughter’s files because the HTML was a disaster. Basically, I had to start the site from scratch.

5. “Do What I Tell You and Don’t Tell Me It Won’t Work!”

Client input is more than welcome and on many projects it helps to make things perfect but this doesn’t mean that every whim of the client is to be followed. Since he or she has hired me for the project, supposedly I know quite a lot about how to get things done. I do listen to clients and try to do things the way they want them but in some cases there demands are just absurd.

Image Credit: 3rdworldman

For instance, even though I appreciate tasteful animation, I basically hate it when a site has animation. Many clients, especially the ones who are far from Web design and development, are fascinated by everything that moves and screams on their site and they consider this the utmost advance in technology. However, for me or for anybody who is familiar with Web and above all, who is a fan of minimalism, all these screaming and jumping objects are more than what I can take.

I sometimes manage to convince clients that (primitive) animation and especially sounds on a Web site are so last century but there are clients who nevertheless insist on having them. Well, animation and sounds aren’t the worst I can think of when it comes to clients who want ridiculous things and take no No for an answer but it is certainly irritating.

Concluding

Fortunately, the things I describe aren’t the norm for the majority of clients. Still, this hard-earned knowledge about what to avoid in a client has made me sincerely appreciate the nice clients I have. Well, maybe the things I hate aren’t a problem for any freelancer and it will be interesting to hear your opinion about this. Do you hate the same things? Are there things you hate more than these 5? Please, share your opinion.

You might also like…

Good Old Static HTML Sites Aren’t Dead Yet. Should They Be? →
Should You Keep Your Website Open Source? →
Should Designers know how to code? What do you think? →
Is a Design House-Style Really Necessary? →



Original from: http://feedproxy.google.com/~r/speckboy-design-magazine/~3/ELPhZvP6-jw/

Activating Ludicrous Speed: Combine CloudFlare With a CDN on Your Blog

February 26th, 2012 Comments off

If you’re trying to speed up your blog, you’ve probably used techniques such as optimizing your images, getting rid of unnecessary plugins and scripts, and minifying your CSS and JavaScript. However, optimizing the content on your local server can only go so far. The next step in the blog speed game is taking advantage of Content Delivery Networks (CDNs).

What is a CDN? Basically, it’s a service that stores certain elements of your site (pictures, JavaScript files, CSS files) and distributes them across a network of geographically dispersed servers. When a visitor hits your site, the CDN will determine the server on their network closest to the visitor and serve your content from there. This can really cut down on your load times!

CloudFlare is a very popular and free CDN that you can use for this purpose. Using CloudFlare alone can result in good loading time decreases on your blog. However, you can decrease these load times even more by combining CloudFlare with a “full” CDN. I’ve been using it in conjunction with MaxCDN for a few months over at my blog, College Info Geek, and I’ve had great results.

In this tutorial, I’m going to show you how to combine these two services on your own blog by using W3 Total Cache. Since CloudFlare is free and MaxCDN is not, I’ll go through CloudFlare first in case you just need a free option. Here we go!


Step 1 Install W3 Total Cache

Before you start creating your CloudFlare account, you’ll want to install and configure the W3 Total Cache plugin on your blog. This is a plugin that takes a little bit to configure. You can follow WPBeginner’s excellent setup tutorial to get all your settings correct before proceeding.


Step 2 Create a CloudFlare Account and Add Your Site

Head over to the CloudFlare website and create an account using your email address and the username of your choice.

Once you’re signed up, it’s time to start getting your website set up with CloudFlare. Note: Some web hosts include an automatic CloudFlare activation option in your cPanel. I strongly suggest you DON’T use this option – I tried it at first and my site ended up going down for three days because of a domain propagation issue. Doing the manual setup is really easy and will help you avoid any downtime or headaches!

Ok, right now you should see a screen that looks like this:

Add your site to CloudFlare

CloudFlare will start scanning your site’s DNS setup, and you’ll get to watch a nice little commercial while that happens. Fun times. Once it’s done (about 45 seconds or so), you can move on to the next step in the process.

Since you’re changing nameservers, it could take up to 24 hours for CloudFlare to become active on your site.

You should now see a page displaying what CloudFlare thinks is in your DNS Zone File. You need to access your actual DNS Zone File and make sure all the entries have been transferred over. This file can be accessed via your website’s cPanel (or similar admin panel). If you can’t find your DNS zone file, contact your host’s support and ask them where you can locate it.

Step 3 lets you choose which A and CNAME records you’d like CloudFlare to control. By default, the A record for your domain and the CNAME record labeled “www” should be the only ones highlighted. I recommend keeping this setting and continuing on.

Finally, Step 4 gives you new nameservers that you need to use for your domain. To swap out your old ones and plug in these ones, head over to your domain registrar’s website and go to your domain manager. If you’re using GoDaddy, you should see a button labeled “Nameservers” right in the domain manager. Other registrars should have a similar tool.


Step 3 Add Your CloudFlare Details to W3 Total Cache

You’ll receive an email once your domain has been propagated to the new nameservers you entered. Once this happens, you’ll be able to access your CloudFlare options. Now it’s time to add your CloudFlare details to W3 Total Cache and start reaping the benefits.

Log in to your CloudFlare account and go to the Account tab. Here you’ll be able to see your Account Email, Username, and your unique API Key. Specifically, you’ll need your Account Email and unique API Key for this part.

Head over to your WordPress Dashboard and find the option labeled Performance. This is the settings panel for W3 Total Cache. On the default General Settings tab, scroll down to the section titled Network Performance and Security powered by CloudFlare. Execute the following steps:

  • Click the checkbox labeled Enable
  • Fill in the email address you used for your CloudFlare account
  • Paste in your API Key
  • Fill in your domain name
  • Set your security level to whatever you deem appropriate. Personally I set it to low. I’ve found that setting it to anything above this seems unnecessary and can actually result in false positive blocks.
  • Make sure Development Mode is off unless you’re making design changes to your site.
  • Click Save all settings.
w3 Total Cache CloudFlare settings

Awesome! You’ve got the first part done. If you want to keep this a no-cost ordeal, you can go ahead and stop right here. Just having CloudFlare should result in a good speed boost for your site. If you want to get even more speed for free, check out the WordPress Speed Quickstart Guide for more tips.

If you want to maximize your potential, however, read on. Next we’ll be implementing MaxCDN.


Step 4 Sign Up for MaxCDN

Alright, so you want to take the plunge and integrate two CDN solutions on your blog. Sweet. Like I said above, I’ve been doing this for about four months now. So far, the combination has worked really well and my site is really snappy (especially for being image-heavy).

Ok, so the first thing to know about MaxCDN (or any “full” CDN) is that it costs money. It’s not wildly expensive, but it costs more than a coffee. So, should you use it? Here’s some guidance:

MaxCDN is generally faster than CloudFlare. As a dedicated CDN, it has more infrastructure set up for serving content as locally as possible. So I think the decision on whether to use it or not should be based on your traffic and your page sizes. Do you have a lot of images and media you’re serving up? Do you have a very visual design with lots of elements that have to load? All these things can increase load times. What about your audience? Are you getting 10 visits a day or 10,000? The more traffic you have, the more important it is that your site be optimized for speed. MaxCDN will take some of the bandwidth load off of your server, so that’s a consideration as well.

If you’ve decided that it’s worth your money, head on over to MaxCDN.com and click the signup button. Choose the Pay as You Go option (you’re probably not big enough for Enterprise, and if you are you should probably talk to MaxCDN themselves about implementation!). The base price for this option is $39.95, but you can get it down to about $30 using coupon codes. For this price, you get one terabyte of CDN bandwidth. This is where CloudFlare integration really comes in handy; by using both, I’ve managed to use only 92GB in the past four months (and this is with 30,000-40,000 pageviews a month). At this rate, the bandwidth should last 3.5 years (although traffic growth will lower this). $30 for 3.5 years isn’t too bad at all.

Once you’re signed up and have your account, go ahead and log in. In order to get MaxCDN delivering your site’s content, you need to set up a zone. Follow these steps to do just that.

  • In your dashboard, go to the Manage Zones tab.
  • You should see a box labeled Pull Zones. Click Create Pull Zone.
  • Fill in your Pull Zone Name. This can be whatever you want.
  • In Origin Server URL, input your entire URL including http://.
  • Enter a Custom CDN Domain. I’d suggest cdn.yourdomain.com.
  • Your Label can be anything you want.
  • Make sure Compression is checked.
  • Click Create.
Create Pull Zone

Step 5 Set Up MaxCDN in W3 Total Cache

The last step in this tutorial is enabling your CDN in W3 Total Cache and customizing it. To do this, go back to the General Settings tab of W3 Total Cache on your blog and scroll down to the section titled CDN.

  • Click Enable.
  • Set your CDN type to NetDNA/MaxCDN.
  • Click Save all settings.
Enable MaxCDN

Next, head over to the CDN tab of W3 Total Cache. Here you’ll tweak the CDN settings to get everything working correctly. Everything under the General section should be left as is – just make sure all the boxes are checked except the last one.

The Configuration section is where you’ll do the most work here. Follow these steps to get it set up correctly:

  • Fill in your API ID and API Key. You can find these by logging into your MaxCDN account, going to My Settings, and going to the API tab. The ID and key will be listed there.
  • Leave the SSL support option as Auto.
  • Replace your site’s hostname with the CDN domain you created (cnd.yourdomain.com).
  • Click Save all settings.
MaxCDN config

Just one last thing to do! Under the Advanced section, check the box at the bottom labeled Set cookie domain to “yourdomain.com”. Everything else can be left alone; if you find that the CDN is having problems with a certain file after you’re up and running, you can remove its filetype later. You’re done!


Conclusion

Now you have a blog powered by both CloudFlare and MaxCDN. You should notice significant speed improvements, which you can make even better by doing things like minifying your CSS and JavaScript, using WP Smush.it on your photos, and minimizing plugin usage. Enjoy your speedy new blog!

Have you had experience with CloudFlare, MaxCDN, or any other content delivery network? Share your experiences with us in the comments below.

Original from: http://wp.tutsplus.com/tutorials/hosting/activating-ludicrous-speed-combine-cloudflare-with-a-cdn-on-your-blog/

20 HDR Photographers Worth Watching

February 26th, 2012 Comments off

Do you need a twist on your photographic inspiration? Check out the following HDR photographers. The techniques they use to create surrealistic images combine multiple exposures to capture a wider range of value and color.

Since most HDR photography is used to achieve difficult exposures with wider dynamic ranges, the subject matter of the art tends to be architectural or landscape in nature; however, there are many different forms of abstract HDR photographers. These photographers are setting the standard for stylized HDR work and are worth studying. Most of their portfolios are extensive, so check them out and let us know which photographers inspire you.

Rob Hanson Photography

Check out Rob Hanson’s website to view some gorgeous examples of photography. His collection of photos show his experience in shooting a variety of subjects, including landscapes, waterscapes, macro, events, and much more.

Rob Hanson Photography →

Alan Fullmer Photography

Alan Fullmer has an inspiring collection of HDR and other photographs of mostly buildings, bridges, and landscapes. While he is still new to HDR, Alan’s talent is already top-notch.

Alan Fullmer Photography →

Gagan Dhiman Photography

HDR is definitely one of Gagan’s specialties, along with black and white photographs. His varied subjects include stunning portraits, weddings, landscapes, automobiles, and much more.

Gagan Dhiman Photography →

Chris Robinson Photography

Chris Robinson started his photography website to share some photos that he took while in Japan, but he decided to continue the blog when he fell in love with photography. Visit his website to view his incredible photos of landscapes, buildings, bridges, gates, and also be sure to check out his blog with very helpful tips for photography. His tutorials are also worth a peek!

Chris Robinson Photography →

Zu Sanchez Photography

While Sanchez’s collection of photos is relatively small on this current website, the HDR photos are fantastic! Keep an eye out for more from this new yet very talented photographer.

Zu Sanchez Photography →

Giloramo Photography

Wow! This photographer’s portfolio of HDR photos will tempt you to spend more than a few minutes on his site. Gorgeous sunsets and sunrises, architecture, docks, and much more provide an inspiration for anyone, whether or not photography is your forte.

Giloramo Photography →

Chuck Robinson Photography

Check out Chuck Robinson’s site for beautiful examples of black and white photos, HDR photos, and photographs of amazing locations. New York, Charleston, Cape May, and the Smokies are just a few of the amazing places that Robinson has visited and photographed.

Chuck Robinson Photography →

Albert Knutsson Photography

Albert Knutsson is an amateur photographer from Sweden with an eye for capturing subjects beautifully, and many in an unusual composition using HDR, unique angles, and other photography techniques. He is definitely worth following as he adds to his beautiful collection of photographs.

Albert Knutsson Photography →

Ariasgonzalo Photography

Ariasgonzalo, or Jose Clobato, boasts a stunning collection of photographs, many of them HDR. More of his photographs and blog posts can be seen on his personal website.

Ariasgonzalo Photography →

John E Adams Photography

Photography has been John Adams’ passion since he was 13 years old, and now his photos definitely show this experience. Much of his collection include boats, bikes, and cars; in 2009 V-Twin and EasyRiders magazines invited Adams to be their featured motorcyclist artist.

John E Adams Photography →

Michael Criswell (Theaterwiz) Photography

Michael Criswell, alias Theaterwiz, has quite the impressive collection of photographs, which include subjects such as Civil War images, urban locations, and more. His “Empress” collection is a series of digitalized photographs that follow a character (The Empress) in a variety of hilarious situations.

Michael Criswell (Theaterwiz) Photography →

Matty Wolin Photography

Matty Wolin’s blog is aptly named ShutterRunner. His photography career began when he decided to bring a camera along to a marathon he was a part of one year. He had so much fun that he continued photographing landscapes and even dove into portraits. His work is quite stunning and definitely worth checking out.

Matty Wolin Photography →

Murphyz Photography

With a varied range of subjects and all equally well-shot, Michael Murphy has a beautiful collection of photos, mostly done with the HDR technique. Many of his shots are of urban places and people which show his eye for creating beauty out of ordinary or decaying subjects, but he does have a few photos of landscapes such as the one shown above.

Murphyz Photography →

Tim Clarke Photography

As a graphic designer as well as photographer, Tim Clarke’s eye for beautiful graphics is obvious. He has been photography since the 80′s, but only recently started dabbling in HDR. His HDR photos do not show it, though, as all are excellently done!

Tim Clarke Photography →

Kevin Miller Photography

This photographer has an excellent eye for brilliant colors, although his black and white photos are quite stunning as well. His HDR photos bring out his colorful touch even more, making him an easy add to any list of favorite photographers!

Kevin Miller Photography →

Barry O’Carroll Photography

Hailing from Dublin, Ireland, O’Carroll does not limit his photography to his beautiful countryside. From his photos from several locations across the globe, you can see why he specializes in travel, cityscape, and landscape photography.

Barry O’Carroll Photography →

Warne Riker Photography

Warne Riker has an incredible portfolio full of portraits, action photographs, black and white images, HDR, and much more. His HDR photos have a certain “glow” that many photographers are unable to capture in their own HDR work. Brilliant!

Warne Riker Photography →

Malcolm MacGregor Photography

Malcolm MacGregor’s blog is definitely one to keep up with, as his photos are incredible and his descriptions and stories behind each are so engaging to read. Many of his photos in his portfolio are of landscapes and portraits, along with a few different subjects such as the bridge photo shown above.

Malcolm MacGregor Photography →

Frank Grace Photography

A photographer from Acushnet, MA, Frank Grace has quite the assortment of gorgeous photos in his portfolio. Some of his subjects include HDR, old cemeteries, light painting, photomanipulation, American theaters, and much more. If you are looking for a photographer with a fresh range of subjects, Grace is one you should definitely add to your list.

Frank Grace Photography →

Michael Lewis Glover Photography

Michael Lewis Glover has been a photographer since he was given his first Santa Clause black and white camera as a child. His experience shines through in his photographs of nature, landscapes, automobiles, and HDR images.

Michael Lewis Glover Photography →

You might also like…

Inspirational and Free Downloadable Photography Magazines →
Beautiful Examples of Photoshopped Smoke Art and Technique Tutorials →
Amazing Images That Could Be HDR – But are definitely Not →
Tutorials for Creating Beautiful HDR (High Dynamic Range) Imagery →
Amazing Examples of Conformal Photography. How do they do this? →
50 Beautiful HDR Images from 50 World Cities →
Beautiful Examples of Photoshopped Smoke Art and Technique Tutorials →
Creative Photography Examples using the Polar Panorama Effect →
Creative and Inspirational Photographs – Distil Ennui →
Examples of Stylish Sabatier (or Solarised) Effect Photography →
Amazing Examples of Conformal Photography. How do they do this? →



Original from: http://feedproxy.google.com/~r/speckboy-design-magazine/~3/a0yuaqlmtdk/

Quick Tip: Create A WordPress Global Options Page

February 25th, 2012 Comments off

WordPress is a great platform to build customized websites in a very efficient way. WordPress manages all this magic in only 11 database tables. wp_options is one of the tables and it acts as the mind of a WordPress powered website.

This table stores all the information related to your website like site name, site description slogan, site URL and lots of other things. All this information can be grabbed easily using the get_option() function, you just need to pass the field name which you want to get. For example: get_option('home') will return the URL of the home page.

But WordPress doesn’t give the opportunity to add new options to this table which can be grabbed easily. So here is a tutorial which creates a new page in your WordPress admin and on that page you can save your custom global options.


What Will We Get?

If you want to store your Twitter ID then just follow this tutorial and you will get your Twitter ID using get_option(‘twitterid’) in the active theme of your WordPress installation.


Code

Here is the code block, where I will go through each step of the code. You just need to place this code block in your functions.php file of your active theme and you are done.


Step 1 Add Admin Menu

This step will just add a new menu for the admin with which we can view our page.

add_action('admin_menu', 'add_global_custom_options');

Step 2 Assign a Function Which Parses the Admin Form

Here we will assign the custom function which will create a form.

	function add_global_custom_options()
	
		add_options_page('Global Custom Options', 'Global Custom Options', 'manage_options', 'functions','global_custom_options');
	

Step 3 Create a Function Which Generates the Form


	

Global Custom Options

Twitter ID:

Please note that this form is for only one field for now. If you want to make it for more fields the you just have to follow the below two steps for each.

1 – Place a new textbox with a unique name. For example if you want to store a Facebook page link then it would be like below:

Facebook Page Links:

2 – You need to update the value of the hidden field with the name “page_options”, in this case it should be updated to the below value.


You can see that all option names are added here separated by a comma(,). Without this step nothing will work as expected.


How to Use?

After placing the above code in functions.php have a look at the admin page. You will find a new link in your Admin Menu called “Global Custom Options”.

Just enter your values in that form and you are good to go for using those values in your theme files like “get_option(‘twitterid’)”.


Future Enhancement

This is just a sample code block with which you will come to understand how this feature could work. If you wanted, you could then extend this functionality to code a plugin with which you could create these fields dynamically and generate the form accordingly.

Do you think you’ll find this code useful in your themes? Let us know what you think of it in the comments.


Update: While this article shows a quick way to achieve a particular result, it does not strictly adhere to best practices. Recommended reading on this topic: Using The Settings API: Part 1 – Create A Theme Options Page

Original from: http://wp.tutsplus.com/tutorials/creative-coding/quick-tip-create-a-wordpress-global-options-page/

Weekly Web Design and Development Inspiration – N.127

February 25th, 2012 Comments off

This is our weekly selection of our favorite web designs from the past week, thanks to everybody for their recommendations. Feel free to comment and let us know what you think.

Have you tried StylesInspiration yet? It is our web design showcase that aims to not only showcase the best and most innovative web design styles currently available, it also aims to give you a visual overview of current web design trends and highlight the latest in innovative web technologies. You’ll love it :)

AIGA 50 DC

AIGA 50 DC

Miracle of Denim

Miracle of Denim

Happy Cog

Happy Cog

Au petit panisse

Au petit panisse

ConvergeSE

ConvergeSE

Thibaud

Thibaud

Buro Happold

Buro Happold

You may like to browse our previous Weekly Inspirations

Weekly Web Design and Development Inspiration Archives →



Original from: http://feedproxy.google.com/~r/speckboy-design-magazine/~3/ibN9YTMDt7g/

Create a Quicksand Portfolio With WordPress

February 24th, 2012 Comments off

Today, you will change your simple portfolio into something amazing with the magic of Quicksand by Razorjack.


Introduction

Ever wanted to use the jQuery plugin Quicksand? Ever tried to implement it with WordPress? But, found it a nightmare to do both? Well, I will be going through a simple step-by-step guide to get you from a blank WordPress theme to a beautiful custom portfolio with the use of Quicksand. I’ll be using a custom theme which has been stripped down for the purpose of this tutorial along with WordPress 3.0+.

So open up your favourite text editor and let’s begin!


Step 1 Create a Post Type

With WordPress, we are capable of creating custom post types where we can manage all of our content. We will create a custom post type to store all of our portfolio items in a dedicated admin section.

For easy code management, let’s begin by creating a folder called portfolio and a PHP file called portfolio-post-types.php (or anything you find suitable).

Once you have created a file, let’s add some code…

Let’s start by creating a function:


Now that we have created our blank function, let’s add some code to make this function do something special. First, create the labels for our custom post type. Insert the following piece of code in our post_type function:

$labels = array(
	'name' => __( 'Portfolio'),
	'singular_name' => __('Portfolio'),
	'rewrite' => array(
		'slug' => __( 'portfolio' )
	),
	'add_new' => _x('Add Item', 'portfolio'),
	'edit_item' => __('Edit Portfolio Item'),
	'new_item' => __('New Portfolio Item'),
	'view_item' => __('View Portfolio'),
	'search_items' => __('Search Portfolio'),
	'not_found' =>  __('No Portfolio Items Found'),
	'not_found_in_trash' => __('No Portfolio Items Found In Trash'),
	'parent_item_colon' => ''
);

A breakdown of the code we have just written:

The ‘labels’ variable is an array of strings that represent your post type, each of the strings are text which is output for the particular function.

  • name – The plural form of the name of your post type.
  • singular_name – The singular form of the name of your post type.
  • rewrite – Rewrite permalinks with this format.
  • add_new – The menu item for adding a new post.
  • edit_item – The header shown when editing a post.
  • new_item – Shown in the favourites menu in the admin header.
  • view_item – Shown alongside the permalink on the edit post screen.
  • search_items – Button text for the search box on the edit posts screen.
  • not_found – Text to display when no posts are found through search in the admin.
  • not_found_in_trash – Text to display when no posts are in the trash.
  • parent_item_colon – Used as a label for a parent post on the edit posts screen. Only useful for hierarchical post types.

Next, create the arguments for our custom post type. Insert the following piece of code into our post_type function:

$args = array(
	'labels' => $labels,
	'public' => true,
	'publicly_queryable' => true,
	'show_ui' => true,
	'query_var' => true,
	'rewrite' => true,
	'capability_type' => 'post',
	'hierarchical' => false,
	'menu_position' => null,
	'supports' => array(
		'title',
		'editor',
		'thumbnail'
	)
);
  • labels – An array of labels for this post type.
  • public – Meta argument used to define default values for publicly_queriable, show_ui, show_in_nav_menus and exclude_from_search.
  • publicly_queryable – Whether post type queries can be performed from the front end.
  • show_ui – Whether to generate a default user interface for managing this post type.
  • query_var – False to prevent queries, or string value of the query var to use for this post type.
  • rewrite – Rewrite permalinks with this format.
  • capability_type – The string to use to build the read, edit, and delete capabilities.
  • hierarchical – Whether the post type is hierarchical. Allows parent to be specified.
  • menu_position – The position in the menu order the post type should appear in the admin.
  • supports – An alias for calling add_post_type_support() directly.

Read more about add_post_type_support in the WordPress Codex

Now our post type is setup with the settings, we need to register the post type. We register our post type by inserting the following code into our post_type function:

register_post_type(__( 'portfolio' ), $args);

Format Custom Post Type Output

We now have our custom post type created. Let’s format the output, so we can get user-friendly messages. Begin by creating another function within our portfolio-post-type.php file.

// function: portfolio_messages BEGIN
function portfolio_messages($messages)

	$messages[__( 'portfolio' )] =
		array(
			0 => '',
			1 => sprintf(('Portfolio Updated. View portfolio'), esc_url(get_permalink($post_ID))),
			2 => __('Custom Field Updated.'),
			3 => __('Custom Field Deleted.'),
			4 => __('Portfolio Updated.'),
			5 => isset($_GET['revision']) ? sprintf( __('Portfolio Restored To Revision From %s'), wp_post_revision_title((int)$_GET['revision'], false)) : false,
			6 => sprintf(__('Portfolio Published. View Portfolio'), esc_url(get_permalink($post_ID))),
			7 => __('Portfolio Saved.'),
			8 => sprintf(__('Portfolio Submitted. Preview Portfolio'), esc_url( add_query_arg('preview', 'true', get_permalink($post_ID)))),
			9 => sprintf(__('Portfolio Scheduled For: %1$s. Preview Portfolio'), date_i18n( __( 'M j, Y @ G:i' ), strtotime($post->post_date)), esc_url(get_permalink($post_ID))),
			10 => sprintf(__('Portfolio Draft Updated. Preview Portfolio'), esc_url( add_query_arg('preview', 'true', get_permalink($post_ID)))),
		);
	return $messages;

 // function: portfolio_messages END

What we have just done is create a function called portfolio_messages that takes an argument called $messages. Following this, we are creating a variable which stores an array for all of our messages. We leave “0″ blank within our array because we begin our indexing at 1 with our messages. Then finally return our array to our function.

Create Taxonomy

Finally, we need to create our taxonomy. Begin by creating another function called portfolio_filter and input the following code:

// function: portfolio_filter BEGIN
function portfolio_filter()

	register_taxonomy(
		__( "filter" ),
		array(__( "portfolio" )),
		array(
			"hierarchical" => true,
			"label" => __( "Filter" ),
			"singular_label" => __( "Filter" ),
			"rewrite" => array(
				'slug' => 'filter',
				'hierarchical' => true
			)
		)
	);
 // function: portfolio_filter END

We begin by registering our taxonomy and then applying the taxonomy to our custom post type portfolio. Following this, we apply the final settings of the taxonomy and input the created labels. The reason we are creating a taxonomy is because we will use it as a reference key when sorting our portfolio with Quicksand.

Now that all of our custom post type is complete along with the correct formatting and our own taxonomy, we need to finally initialise all of our code so that it will be displayed in the admin. Let’s begin by adding the following code at the bottom of our file:

add_action( 'init', 'post_type' );
add_action( 'init', 'portfolio_filter', 0 );
add_filter( 'post_updated_messages', 'portfolio_messages' );

Once we have input this, we then need to open our functions.php file and insert the following line of code:

include("portfolio/portfolio-post-types.php");

We need to include our custom portfolio type into our functions.php file for the script to run when the functions of your WordPress theme are being called. Now you will see in your admin panel a section titled Portfolio with 3 sub-navigation items called “Portfolio”, “Add Item”, and “Filter”.


Step 2 Create Portfolio Page

Now we have our entire portfolio settings complete, we need to output our portfolio items. We begin this by creating a new PHP file called portfolio.php. Firstly let’s add some of the essentials for the creation of a page template:



	

	
	
// We will add our content later

Now, we have our fundamental page template created we need to populate our portfolio. We need to create a page first which will act as our Portfolio page, so head to the Pages -> Add New in our Dashboard. On the right hand side, you will see a box titled Page Attributes with a drop down of Default Template, select the desired template you would like to use in our case portfolio should be selected and then select publish.

Display the Filter

Now, let’s go back to editing our Portfolio page template and begin to insert the filter for our portfolio. First, we begin by wrapping the filter within an unordered list and each of the categories will be an element in our list.


Let’s add some PHP to our filter to automatically generate the filter categories that are being used within our portfolio.

 0) 
		foreach ($terms  as $term) 
		$i++;
		$term_list  .= '
  • ' . $term->name . '
  • '; if ($count != $i) $term_list .= ''; else $term_list .= ''; } echo $term_list; } ?>

    What we are doing here is first initialising the taxonomy we wish to get, in our case filter. Secondly, set up a count with our categories for us to increment over each element within our filter, and then apply a conditional statement to check if the count that we have set is less than 0; meaning that if there are no categories in the filter or no categories assigned to a portfolio item, nothing will be output. If there are categories in our filter then we want to alter the output for each element.

    We do this by the following line within our segment of code:

    $term_list .= '
  • ' . $term->name . '
  • ';

    We are creating a list element to fit within our unordered list, and then setting the “href” to a blank target because Quicksand will handle the organising of content, then we set our class name to the slug of the portfolio item for consistent referencing, and finally outputting the name of the category within our filters.

    Display the Portfolio Items

    Brilliant, we now have a dynamic filter implemented. Now we are going to output our portfolio items. Let’s begin querying our database in order to get all the posts for the portfolio post type and set up our WordPress Loop. We begin by setting up a new WP_Query object and pass the correct parameters to it.

      'portfolio',
    			'posts_per_page'  =>'-1'
    		)
    	);
    ?>
    

    We assign our WP_Query object to a variable so we can reference our query when we are initialising our Loop. We set our post type to portfolio so we only query our custom post type which we created earlier and finally set the posts_per_page to -1. We use -1 so that there are no fixed limitations to the amount of posts per page, therefore displaying all portfolio items, if we wanted we could also enter any number and it would only display the amount of portfolio items which was entered here.

    Now that we have a query object which we can reference, let’s set up our Loop to output our portfolio items. We begin by inserting the following code:

    have_posts()) : while  ($wpbp->have_posts()) : $wpbp->the_post(); ?>
    
    	
    
    
    
    

    Before we begin entering content into our loop, we are going to set up our featured images. Open up your functions.php file and we will add some custom featured image sizes to be output for each portfolio item.

    Let’s check first if the current version of WordPress handles the featured image functionality, and then set up some general settings for it to work correctly. We add support for the post-thumbnails and set a default size of 56px by 56px.

    if ( function_exists( 'add_theme_support' ) )
    
    	add_theme_support(  'post-thumbnails' );
    	set_post_thumbnail_size(  56, 56, true );
    
    

    Then we want to add our own custom thumbnail sizing. Insert the following code on a line below: set_post_thumbnail_size

    add_image_size( 'portfolio', 295, 150, true );
    

    This method allows you to create your own thumbnail size by first setting the reference name for the thumbnail, then the width and height and finally if the thumbnail should hard crop the image to fit the size specified. You can alter the sizes of your featured image to fit with your layout; with the purpose of this tutorial I have a 3 column grid layout.

    Now that we have our Featured Image set up, we are going to head back to our portfolio page template and output the portfolio item featured image.

    As the organisation for each portfolio item is best handled by an unordered list, we will first create one and then output our featured image which we have just setup. Insert the following code inside your WordPress Loop:

    We initially check if the theme supports the thumbnail function. If the theme supports this feature then it will output the feature image at the dedicated thumbnail we have specified earlier. After outputting our featured image, we then output the title of the Portfolio item directly below the image.

    Connect Portfolio Items & Filter

    We need to tweak the different elements of each portfolio list item to ensure that the referencing for each portfolio is correct to the categories the item is assigned to. For this, we will first need to get the categories from our taxonomy. Insert the following code within your Loop:

    
    

    Next, we are going to add some attributes to our list element (li). We begin by adding a data-id to our list item, to provide a unique identity to each of the portfolio items. We are also going to add a data-type; this will act as our referencing to our filter. Let’s replace our opening list element (li) with the following code:

  • We apply a count to our data-id, and when looping through each item, the count will be increased (we will add the count shortly). We then loop over each category in our taxonomy and apply a regular expression to find the spaces and replace it with a “-” to match the slug of the category and then finally put a blank space at the end, so we are able to apply more than one category to a portfolio item.

    Finally, we are going to ensure that we increment our count and provide a unique reference to each of our portfolio items. We need to add the following code just before we end the loop:

    
    

    Final Code for Displaying Portfolio

      'portfolio', 'posts_per_page' =>'-1' ) ); ?> have_posts()) : while ($wpbp->have_posts()) : $wpbp->the_post(); ?>

    Step 3 jQuery & Quicksand

    We’re making progress now, but before we continue we need to go and download some jQuery scripts. We need to download the following scripts:

    We also need to create a JavaScript file to handle all of our custom jQuery that we will be writing shortly. So let’s create a blank JavaScript file called jquery.custom.js. Now that we have all of our essential scripts, let’s open our functions.php and create a blank function called register_js. Once we have our blank function, we are going to insert our scripts using the wp_register_script and wp_enqueue_script methods. First, we must check that we’re not in the admin to ensure the scripts are only loaded on the front end. Insert the following code into our function:

    // Register our scripts
    function register_js()
    
    	if ( !is_admin() )
    	
    		wp_register_script( 'quicksand', get_template_directory_uri() . '/js/jquery.quicksand.js', 'jquery' );
    
    		wp_register_script( 'easing', get_template_directory_uri() . '/js/jquery.easing.1.3.js', 'jquery' );
    
    		wp_register_script( 'custom', get_template_directory_uri() . '/js/jquery.custom.js', 'jquery', '1.0', true );
    
    		wp_enqueue_script( 'jquery' );
    		wp_enqueue_script( 'quicksand' );
    		wp_enqueue_script( 'easing' );
    		wp_enqueue_script( 'custom' );
    	
    }
    

    First with wp_register_script we specify a handle as our first argument for reference when enqueuing the scripts, then add the source link to the script as our second argument (this applies to each registration of a script). We also specify jquery as a dependency to load WordPress’ included version of jQuery when we enqueue the script.

    Once we have registered all of our scripts, we then enqueue them by using wp_enqueue_script. We pass all the handles that we used when registering as a reference to enqueue our scripts. Finally, we need to initialise our function by adding the following code in our functions.php file:

    add_action('init', 'register_js');
    

    Writing Quicksand

    Now that we have all of our scripts in place, we can begin writing our jQuery custom script for the handling of Quicksand. Let’s open up our jquery.custom.js script and let’s set up the environment by inserting the following code:

    jQuery(document).ready(function() 
    
    	// We will insert our quicksand script in here
    
    ); // END OF DOCUMENT
    

    Now we have our script structure, we will create a function called portfolio_quicksand and only execute if the Quicksand plugin exists.

    function portfolio_quicksand() 
    
    	// All of our quicksand handling will happen in this function
    
    
    
    if(jQuery().quicksand) 
    
    	portfolio_quicksand();
    
    
    

    I will break down the following into smaller steps for you to understand all that is taking place when creating a Quicksand portfolio. Let’s begin by setting up our variables. Insert the following code into our portfolio_quicksand function:

    var $filter;
    var $container;
    var $containerClone;
    var $filterLink;
    var $filteredItems;
    

    We will be using these variables more frequently, so it’s always a good way to get a solid foundation of variables set up. Next we are going to assign our variables:

    $filter = $('.filter li.active a').attr('class');
    $filterLink = $('.filter li a');
    $container = $('ul.filterable-grid');
    $containerClone = $container.clone();
    

    We first set up our filter to the unordered list class from our portfolio page template. Secondly, we set up a filterLink; this will act as our clicked item within our filter. Then we need to assign our container of our portfolio items, and finally we require a cloned version of our container, to manipulate the data with Quicksand.

    Next, we are going to write our click function, so when a user selects a category the container should be manipulated and the output of the content should display. Let’s start by calling a click function on our filterLink:

    $filterLink.click(function(e) 
    
    	// We will add the content for this function now...	
    
    );
    

    Now let’s handle the active state of the list element. We begin by first removing any class with a current active state, then searching through the filter and splitting the filter into separate items, and finally applying an active class to the clicked item (category):

    	$('.filter li').removeClass('active');
    
    	$filter = $(this).attr('class').split(' ');
    
    	$(this).parent().addClass('active');
    

    This will help when styling your filter, because you will be able to provide active states for when a user has selected a category.

    Moving on, we will handle a condition for the filtering of our data. We begin by first checking if all has been selected. If all has been selected then display all the elements within our container, else display the items within the container which has been selected by the filter.

    Previously, when we were creating our portfolio page template and we assigned a data-type to each of our portfolio items, this is where we will be using it as a reference key to find our selected data.

    	if ($filter == 'all') 
    		$filteredItems = $containerClone.find('li');
    	
    	else 
    		$filteredItems = $containerClone.find('li[data-type~=' + $filter + ']');
    	
    

    Finally, we call the Quicksand method, and pass our filteredItems and all of our animation options:

    	$container.quicksand($filteredItems,
    	
    		duration: 750,
    		easing: 'easeInOutCirc',
    		adjustHeight: 'dynamic'
    	);
    

    Final Code for Our Quicksand

    function portfolio_quicksand() 
    
    	// Setting up our variables
    	var $filter;
    	var $container;
    	var $containerClone;
    	var $filterLink;
    	var $filteredItems
    
    	// Set our filter
    	$filter = $('.filter li.active a').attr('class');
    
    	// Set our filter link
    	$filterLink = $('.filter li a');
    
    	// Set our container
    	$container = $('ul.filterable-grid');
    
    	// Clone our container
    	$containerClone = $container.clone();
    
    	// Apply our Quicksand to work on a click function
    	// for each of the filter li link elements
    	$filterLink.click(function(e)
    	
    		// Remove the active class
    		$('.filter li').removeClass('active');
    
    		// Split each of the filter elements and override our filter
    		$filter = $(this).attr('class').split(' ');
    
    		// Apply the 'active' class to the clicked link
    		$(this).parent().addClass('active');
    
    		// If 'all' is selected, display all elements
    		// else output all items referenced by the data-type
    		if ($filter == 'all') 
    			$filteredItems = $containerClone.find('li');
    		
    		else 
    			$filteredItems = $containerClone.find('li[data-type~=' + $filter + ']');
    		
    
    		// Finally call the Quicksand function
    		$container.quicksand($filteredItems,
    		
    			// The duration for the animation
    			duration: 750,
    			// The easing effect when animating
    			easing: 'easeInOutCirc',
    			// Height adjustment set to dynamic
    			adjustHeight: 'dynamic'
    		);
    	});
    }
    

    Step 4 Lightbox Integration (Additional Extra)

    Amazing right, you should now have a fully functionally Quicksand portfolio, but let’s not stop just there. I’m going to put an additional extra, this is totally optional but it could become a favourite feature, and that’s Lightbox. We will be using the jQuery plugin called PrettyPhoto for our Lightbox integration.

    First thing we are going to do is download the PrettyPhoto plugin.

    Once we have downloaded our PrettyPhoto files, we will first copy over the PrettyPhoto images, which will be in the images folder and then you need to copy the folder titled PrettyPhoto into our theme. We also need to copy over the CSS and PrettyPhoto’s JavaScript file, so let’s copy them over to the appropriate folders in our theme.

    Now that we have all of our files in place, we need to initialise them within our theme. Within our functions.php file, we will create another function to handle our styles and we will call this function register_css. Then we will register our styles and enqueue our styles, thus insert the following code into your functions.php file:

    // Register our styles
    function register_css()
    
    	if (!is_admin()) 
    		wp_register_style( 'prettyPhoto', get_template_directory_uri() . '/css/prettyPhoto.css' );
    		wp_enqueue_style( 'prettyPhoto' );
    	
    }
    
    add_action( 'init', 'register_css' );
    

    We have all of our files in place and they are being initialised by our theme. Now we need to make use of this and implement Lightbox into our theme. Let’s open up our portfolio.php (portfolio page template) and add some code to our Featured Image.

    First, we need to get a large image of the featured image which has been set. This will then act as the fullsize image when the user clicks on the image and PrettyPhoto loads. Inside our WordPress Loop, we need to insert the following code:

    
    

    The code we have inserted will find the current post within the loop and find the original source of the image and then find the fullsize version of the image. Once we have returned our full size image, we will force the image to be stored in the array index of 0. This is used for no overrides or duplicates with our full size images.

    Once we have our full size image accessible, we will now initialise PrettyPhoto on our featured image. The following code will link the fullsize image to the featured image of the portfolio item and pass the reference to PrettyPhoto, replace the code where you created your featured image with the following:

    
    

    Great, we have got all of our files and scripts in place, we have got the full size image for our featured image and we have referenced our featured image to our full-size image with PrettyPhoto. Next, we need to write our JavaScript to make the Lightbox appear and work.

    Let’s head back to our jquery.custom.js file and create another blank function to handle our PrettyPhoto:

    function lightbox() 
    
    	// Our Lightbox functioning will be added now...
    
    
    
    if(jQuery().prettyPhoto) 
    	lightbox();
    
    

    Now that we have our function, we will initialise PrettyPhoto. We do this by adding the following code within our Lightbox function:

    jQuery("a[rel^='prettyPhoto']").prettyPhoto(
    	animationSpeed:'fast',
    	slideshow:5000,
    	theme:'pp_default',
    	show_title:false,
    	overlay_gallery: false,
    	social_tools: false
    );
    

    You can read the full documentation of all the parameters that PrettyPhoto will accept in the use of the plugin at: PrettyPhoto jQuery Lightbox Clone

    So, it’s all done! Lightbox implementation into your WordPress theme, but wait let me guess when you click on the filter and use Quicksand; the Lightbox is no longer working. That’s because we need to alter our Quicksand script and pass one more small piece of code to make sure that Lightbox works even when we filter through our portfolio.

    So let’s fix this small problem by adding the following script to our portfolio_quicksand function within our jquery.custom.js file:

    $container.quicksand($filteredItems,
    	function ()  lightbox(); 
    );
    

    What we do here is call the Quicksand plugin once more and pass a function within this call to our Lightbox function. So every time Quicksand filters the content, the Lightbox function is called applying the PrettyPhoto to each image.


    Step 5 Pagination Integration (Additional Extra)

    Many people love having the use of Quicksand, but some people like the use of both Quicksand and pagination within their portfolios. This is another additional extra to create pagination within your portfolio. I will be using the WordPress plugin: WP_PageNavi.

    Let’s first install and activate the plugin. Head to the Plugins -> Add New page in our admin section and search WP_PageNavi, once found click Install Now and Activate Plugin once installed.

    Now that we have our plugin setup, let’s open up our portfolio page template and make some modifications to our file.

    First, we need to setup our page to allow pagination. We do this by inserting the following segment of code before we query our database:

    $paged = get_query_var('paged') ? get_query_var('paged') : 1;
    

    Once we have our pagination initialised, we need to modify the database query. We change the post_per_page to a number to display a maximum number of posts which will be displayed on each page. Then we pass a new parameter to our query paged and reference this to our code segment which allowed us to paginate the page, as the following code demonstrates:

    $wpbp = new WP_Query(array( 'post_type' => 'portfolio', 'posts_per_page' =>'2', 'paged' => $paged ) );
    

    Great, we have a portfolio with pagination. We just need some controls to help us with the navigation of each page. The following code checks if the WP_PageNavi plugin is installed and then initialises the wp_pagenavi with the query of the database passed as a parameter. We then reset our postdata and all content is correctly paginated.

     $wpbp ) );
    		wp_reset_postdata();
    	
    ?>
    

    That’s it! You will have a fully functional portfolio with Quicksand, Lightbox and Pagination.


    Conclusion

    Give yourself a pat on the back! You have successfully created a Quicksand portfolio with WordPress. All the hard work is done and you can implement it with any work you develop.

    I would like to say a HUGE thank you for spending the time to read my tutorial, I hope it helped. Please feel free to leave comments and I will try my best to assist and answer them.

    Original from: http://wp.tutsplus.com/tutorials/theme-development/create-a-quicksand-portfolio-with-wordpress/