<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>We Are Pixel8 &#187; Tips &amp; Tutorials</title> <atom:link href="http://www.wearepixel8.com/category/blog/tips-and-tutorials/feed/" rel="self" type="application/rss+xml" /><link>http://www.wearepixel8.com</link> <description>A San Antonio, TX Website Design, Marketing &#38; Content Strategy Studio</description> <lastBuildDate>Tue, 24 Jan 2012 18:46:11 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=3.2.1</generator> <item><title>Use a Conditional Statement to show WordPress Pagination</title><link>http://www.wearepixel8.com/2821/use-a-conditional-statement-to-show-wordpress-pagination/</link> <comments>http://www.wearepixel8.com/2821/use-a-conditional-statement-to-show-wordpress-pagination/#comments</comments> <pubDate>Wed, 18 Jan 2012 18:01:42 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wordpress theme development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2821</guid> <description><![CDATA[Today I will show you how to quickly &#038; easily conditionally add WordPress pagination to your loop.]]></description> <content:encoded><![CDATA[<p>If you have ever developed a WordPress theme, you have inevitably come across having to add some sort of pagination to the WordPress loop. Whether in your “index.php”, “archives.php” or “search.php”, you end up adding some code that looks like the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
&lt;div class=&quot;pagination&quot;&gt;
	&lt;p class=&quot;alignleft&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_posts_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&amp;laquo; Older Posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
	&lt;p class=&quot;alignright&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> previous_posts_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer Posts &amp;raquo;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
&lt;/div&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// no posts found ?&gt;</span></pre></div></div><p>So what&#8217;s wrong with this code? Technically, nothing at all. You are simply hooking into the <code>next_posts_link()</code> and <code>previous_posts_link()</code> to show the “Older” and “Newer” post links. But, when you check out your source code, in the browser, you will notice that there is an empty <code>div</code> tag at the end of your posts. And, if you are anything like me, you <strong>hate</strong> empty div tags!</p><p>Well, fear not. There is a simple way to avoid those pesky empty <code>divs</code> from destroying your otherwise beautiful markup with a simple function and conditional statement.</p><h2>Step 1: The function</h2><p>I like to keep my development workflow and simplistic as possible. So, instead of writing extra lines of code every time I need to check if pagination is needed, I created a simple function to do the job for me. Open up your “functions.php” file and add the following. I recommend placing this at the end of the file, right before the closing &lt;?php ?&gt; tag.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*-----------------------------------------------------------------------------------*/</span>
<span style="color: #666666; font-style: italic;">/* Pagination test
/*-----------------------------------------------------------------------------------*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wap8_show_posts_nav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_query</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_query</span> <span style="color: #339933;">-&gt;</span> <span style="color: #004000;">max_num_pages</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #339933;">&lt;/</span>code<span style="color: #339933;">&gt;</span></pre></div></div><p>In a nutshell, all we are doing here is checking if there is more than one page to display with this loop. Nothing fancy or complicated here. Same the file and let&#8217;s move on.</p><h2>Step 2: Add the condition to the loop</h2><p>Remember the block of code I showed you at the beginning of this post. Well, we need to modify this to work with our function. Change that block of code to the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> wap8_show_posts_nav<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;div class=&quot;pagination clear&quot;&gt;
		&lt;p class=&quot;alignleft&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_posts_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&amp;laquo; Older Posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
		&lt;p class=&quot;alignright&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> previous_posts_link<span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Newer Posts &amp;raquo;'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/p&gt;
	&lt;/div&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span> <span style="color: #666666; font-style: italic;">// no posts found ?&gt;</span></pre></div></div><p>As you can see, after the <code>endwhile</code>, we add a conditional check using our function. If there is more than one page, show the <code>div</code>, if not, move on and do nothing.</p><p>That&#8217;s it. Happy WordPress developing!</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2821/use-a-conditional-statement-to-show-wordpress-pagination/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Use the WordPress Excerpt for Simple SEO Meta Descriptions</title><link>http://www.wearepixel8.com/2756/use-the-wordpress-excerpt-for-simple-seo-meta-descriptions/</link> <comments>http://www.wearepixel8.com/2756/use-the-wordpress-excerpt-for-simple-seo-meta-descriptions/#comments</comments> <pubDate>Tue, 25 Oct 2011 19:13:47 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wordpress theme development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2756</guid> <description><![CDATA[A quick and easy tutorial for dynamically adding SEO friendly meta descriptions to your WordPress website.]]></description> <content:encoded><![CDATA[<p>The <a
title="All in One SEO Pack Plugin" href="http://wordpress.org/extend/plugins/all-in-one-seo-pack/">All in One SEO Pack</a> is, by far, the most popular WordPress plugin for optimizing your WordPress website for search engines. We have continually recommended its usage to clients who are looking for granular control over every aspect of your website. In fact, we were running this powerful little plugin up until this iteration of our site.</p><p>But, as I was going over every aspect of our site in preparation for the redesign, I realized that we were only using the plugin to generate meta descriptions. This was overkill if we weren&#8217;t going to use the plugin to its fullest potential.</p><p>Luckily, I can achieve the exact same goal, without the use of the plugin, by using the built in WordPress post <a
title="WordPress Codex: Function Reference/the excerpt" href="http://codex.wordpress.org/Function_Reference/the_excerpt">excerpt</a> and the <code>get_the_excerpt()</code> function.</p><p><em>Note: This tutorial is written exclusively for WordPress 3.2.1 and has been tested with that version of the application.</em></p><h2>Step 1: Add excerpts to your WordPress pages</h2><p>WordPress allows you to manually write your own excerpts for posts. When you create a new post, you normally will see the Excerpt meta box appear on the editor screen for that post. This is not the case for pages natively. In order for this to work, we first need to hook into the <code>add_post_type_support()</code> function to add the Excerpt meta box to pages as well.</p><p>Open up your “functions.php” file and add the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_page_excerpt'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">function</span> wap8_page_excerpt<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	add_post_type_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'excerpt'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Once you have saved your file, go ahead and test it by adding a new page. You should now see the Excerpt meta box appear on page editor screen. You are now free to add your excerpts to your pages and posts.</p><h2>Step 2: Dynamically add meta descriptions to your site</h2><p>If you were developing an HTML website, you would simply add your meta descriptions to the <code>&lt;head&gt;</code> section of each page. But, as I am sure you are aware, there is only one template, “header.php”, that generates this code for the entire site. Now that you have added all of your excerpts, you will need a function to dynamically add them to the <code>&lt;head&gt;</code> section of your site.</p><p>In order to accomplish this, we need to conditionally check if WordPress is displaying a post or page and have it return a meta description based on the results. You might think it easiest to add this condition directly to the “header.php” template and you are not totally off base. But, I like to keep this template as tidy as possible, so I am going to add another function to my “functions.php” file. In order for this to work, you need to make sure that your “header.php” template has <code>&lt;?php wp_head(); ?&gt;</code> just before the closing <code>&lt;/head&gt;</code> tag.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_action( 'wp_head', 'wap8_meta_descriptions' );
function wap8_meta_descriptions() {
	if ( is_page() || is_singular( 'post' ) ) {
	?&gt;
&lt;meta name=&quot;description&quot; content=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span> get_the_excerpt<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;
	<span style="color: #000000; font-weight: bold;">&lt;?php</span>	
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>Save your file and you are done. Take a look at your post or page source code and you should see your newly added meta description. You can extend this function by conditionally checking for <code>is_home()</code> or <code>is_front_page()</code> for the home page.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2756/use-the-wordpress-excerpt-for-simple-seo-meta-descriptions/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Five Reasons to Have a Content Calendar</title><link>http://www.wearepixel8.com/2748/five-reasons-to-have-a-content-calendar/</link> <comments>http://www.wearepixel8.com/2748/five-reasons-to-have-a-content-calendar/#comments</comments> <pubDate>Wed, 19 Oct 2011 18:58:09 +0000</pubDate> <dc:creator>Jeanette Fernandez</dc:creator> <category><![CDATA[Business Tips]]></category> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[content calendar]]></category> <category><![CDATA[content strategy]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2748</guid> <description><![CDATA[Coming up with new content doesn't have to be so daunting. Creating an editorial calendar will kick things into gear.]]></description> <content:encoded><![CDATA[<p>For anyone who has their own website, or is in charge of overseeing content for a company website, you know by now that creating new content is constant. It can be overwhelming at times to come up with new topics, especially on the fly. This is why I highly recommend using a content calendar. Content (or editorial) calendars have been a staple at print magazines for years. Here are five good reasons it should be a staple for you:</p><ol><li>Helps Save Time &#8211; Having your topics ready in advance, with set publish dates, goes a long way in keeping you on track. No more fumbling around for ideas at the last minute means more time can be spent on the actual writing.</li><li>Keeps You Connected With Your Users &#8211; Because you have a content calendar, you have fresh content ready to be posted. The more new content to post, the more opportunity you give your users to interact with you.</li><li>A Schedule Saver &#8211; For websites with multiple content writers, a content calendar is a must when it comes to coordinating who is writing what and when. It makes everyone involved responsible for their particular content role.</li><li>Establishes Your Site&#8217;s Tone &#8211; Utilizing a content calendar is a great way to be consistent in your editorial style, whether it be professional, humorous, inspirational,or a myriad of others. Your users will get to know you via your style and come to rely on it.</li><li>Helps Your Traffic &#8211; Users love fresh content. Keeping a constant stream of new content flowing on your website is a surefire way to gain the interest of users, return and new. New content means increased traffic. It&#8217;s as simple as that.</li></ol><div><span
class="Apple-style-span" style="font-size: 14px; line-height: 23px;">Need some tips on coming up with you editorial calendar? Let me know!<br
/> </span></div> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2748/five-reasons-to-have-a-content-calendar/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Remove or Add WordPress Widget Sidebars in a Child Theme</title><link>http://www.wearepixel8.com/2691/remove-or-add-wordpress-widget-sidebars-in-a-child-theme/</link> <comments>http://www.wearepixel8.com/2691/remove-or-add-wordpress-widget-sidebars-in-a-child-theme/#comments</comments> <pubDate>Wed, 05 Oct 2011 20:18:11 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[child theme]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wordpress theme development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2691</guid> <description><![CDATA[Learn how to quickly remove or add widget ready sidebars in a WordPress child theme.]]></description> <content:encoded><![CDATA[<p>Many of our premium WordPress theme customers have asked us how to add or remove widget sidebars from any of our <a
title="Browse We Are Pixel8's Premium Theme Releases" href="http://www.wearepixel8.com/work/#premium-themes">products</a>. The process is quite simple and I thought others may find this tutorial helpful. As always, any customizations to a WordPress theme should only be done in a child theme and never in the core files themselves.</p><h2>How to remove sidebars in my child theme.</h2><p>You may find yourself not needing all of the sidebars made available by a particular theme. You can easily deactivate any of the parent theme&#8217;s sidebar by unregistering them in a child theme&#8217;s function.php file. All you will need is the sidebar&#8217;s ID and your own custom function. Using <a
title="Periodic Premium WordPress Theme" href="http://themeforest.net/item/periodic-a-premium-wordpress-magazine-theme/146174?ref=wearepixel8">Periodic</a> as an example, the theme has a total of 6 widget sidebars whose ID&#8217;s are “home”, “right”, “left”, “footer-column-one”, “footer-column-two”, “footer-column-three”.</p><p>Let&#8217;s say that you have no need for the 3 columns in the footer. In your child theme&#8217;s function.php file, you would add the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// My Child Theme Setup</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'after_setup_theme'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_child_theme_setup'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">11</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wap8_child_theme_setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Remove those useless sidebars</span>
	add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'widgets_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_child_theme_sidebars'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Unregister 3 Periodic Footer Widget Sidebars</span>
<span style="color: #000000; font-weight: bold;">function</span> wap8_child_theme_sidebars<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-one'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-two'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-three'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>Let&#8217;s take a look at what we are doing here. WordPress has a handy <code>after_setup_theme</code> hook. This hook will run after the theme&#8217;s functions.php has been included. According to the codex:</p><blockquote><p>“This hook is called during a themes initialization. [It is] generally used to perform basic setup, registration, and init actions for a theme.”</p></blockquote><p>With that in mind, I created a function called <code>wap8_child_theme_setup()</code>. Within this function, I can now add all of my customs actions and filters in one sweep, so to speak. What you should take important notice of is the number “11” inside of the action. This sets a priority for this particular action, with “0” being most important.</p><p>The reason I have set this to “11” is because a child theme&#8217;s function.php file will load <strong>before</strong> the parent theme&#8217;s function.php file. With that in mind, I know that I need to give my <code>wap8_child_theme_setup()</code> function a lower priority insuring that it loads later. If I do not set a lower priority for this action and allow it to fire first, the function will attempt to unregister a function that does not yet exist. <em>Note: You can set priorities for each of the actions and filters within this function as well.</em></p><p>Next you will notice that I have a function called <code>wap8_child_theme_sidebars()</code>. Inside of this function, I am using the <code>unregister_sidebar( $id )</code> function to remove the sidebars I no longer need. Save the file to your child theme&#8217;s directory and you have now successfully removed three of the parent theme&#8217;s widget sidebars without touching the core files.</p><h2>How to add sidebars to my child theme.</h2><p>You can add sidebars to your child theme in the same manner you would in a parent theme. All you will need is a custom function that fires the <code>register_sidebar()</code> function inside of your <code>wap8_child_theme_sidebars()</code> function. Let&#8217;s say you want a sidebar just for a contact page. Edit the child theme&#8217;s function.php file to look like the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// My Child Theme Setup</span>
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'after_setup_theme'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_child_theme_setup'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">11</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wap8_child_theme_setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Remove those useless sidebars</span>
	add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'widgets_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_child_theme_sidebars'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Unregister 3 Periodic Footer Widget Sidebars</span>
<span style="color: #000000; font-weight: bold;">function</span> wap8_child_theme_sidebars<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-one'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-two'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	unregister_sidebar<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'footer-column-three'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #666666; font-style: italic;">// Register child theme sidebar for Contact Page</span>
	register_sidebar<span style="color: #009900;">&#40;</span>
		<span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
			<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'my-child-contact'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'name'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Sidebar for Contact Page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'periodic'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'description'</span> <span style="color: #339933;">=&gt;</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Drag, organize and save widgets for the sidebar that will appear on your Contact page.'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'periodic'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;div id=&quot;%1$s&quot; class=&quot;sidebar-widget %2$s&quot;&gt;'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'after_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'before_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;h2 class=&quot;widget-head&quot;&gt;'</span><span style="color: #339933;">,</span>
			<span style="color: #0000ff;">'after_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;/h2&gt;'</span>
		<span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>If you have ever added widget ready sidebars to a WordPress theme, this is all very familiar to you. If not, take a look at the array inside of the <code>register_sidebar()</code> function and its arguments.</p><ul><li><strong>id:</strong> Give your sidebar a unique ID. The ID must be in lowercase without any spaces.</li><li><strong>name:</strong> Give your sidebar a name that will appear on the Widgets settings page.</li><li><strong>description:</strong> Give your sidebar a description (optional).</li><li><strong>before_widget:</strong> This is the markup that will appear before the widget. The <code>%1$s</code> and <code>%2$s</code> are text substitutions that allow WordPress to assign a unique variable to each active widget so it may keep track of them. I added another class of sidebar-widget for styling purposes and is completely optional.</li><li><strong>after_widget:</strong> The markup that will appear after the widget.</li><li><strong>before_title:</strong> The markup that will appear before the widget&#8217;s title</li><li><strong>after_title:</strong> The markup that will appear after the widget&#8217;s title</li></ul><p>All that is left now is to save your file and upload it to your child theme&#8217;s directory. With your child theme activated, visit your Widget settings page and view all of your changes.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2691/remove-or-add-wordpress-widget-sidebars-in-a-child-theme/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Add a Home Page Link to your Logo in WordPress</title><link>http://www.wearepixel8.com/2673/add-a-home-page-link-to-your-logo-in-wordpress/</link> <comments>http://www.wearepixel8.com/2673/add-a-home-page-link-to-your-logo-in-wordpress/#comments</comments> <pubDate>Tue, 27 Sep 2011 16:22:17 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[php]]></category> <category><![CDATA[wordpress theme development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2673</guid> <description><![CDATA[Though bloginfo('url') is recommended for returning the home page URL in a WordPress environment, using the template tags, home_url() and site_url(), are far more flexible.]]></description> <content:encoded><![CDATA[<p>Over the years, as WordPress developers, we have become accustomed to adding a link to our home page by using the provided template tag, <code>bloginfo('url')</code>. This is not entirely incorrect and, according the the <a
title="WordPress Codex: Function Reference/bloginfo" href="http://codex.wordpress.org/Function_Reference/bloginfo#Show_Blog_Title_in_Link">WordPress Codex</a>, it is recommend. But, this method becomes problematic when WordPress is installed in a sub directory of the root (ex. yoursite.com/wordpress).If we use this template tag, the link will point to this URL and not the root URL, yoursite.com.</p><p>At this point, you are probably saying to yourself, why not simply hard code a link to the root? Technically, again, you are correct. A quick fix would be to add the desired URL to the href and call it a day. It would require less than two seconds of work and you got the job done. But, did you know there are two template tags, <code>home_url()</code> and <code>site_url()</code>, that will not only do the work for you, but return the correct protocol?</p><p>You first need to understand the differences between the two tags. You would use <code>home_url()</code> to get the website address, as defined in the General Settings by the administrator. On the contrary, you would use site_url() to get the WordPress address, as defined in the General Settings. I know. It sounds the same, right? Let&#8217;s say you have WordPress installed in your root directory and you want to link your beautifully crafted logo back to the home page. Let&#8217;s also say you have both the Site and WordPress address settings set to the same URL. You could use the following to return the needed URL.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> home_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_template_directory_uri<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/images/logo.png&quot; alt=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/a&gt;</pre></div></div><p>Seems simple enough. This code will return the URL from the website address settings. Done. End of story. Mission accomplished. But, wait. We said that both the website and WordPress settings were identical. This means we could also use this bit of code to accomplish the same thing.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; title=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;img src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_template_directory_uri<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/images/logo.png&quot; alt=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'name'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; /&gt;&lt;/a&gt;</pre></div></div><p>Is your head spinning yet? I know mine was when I was first trying to understand the usage of these two tags. I eventually decided to determine the usage based solely on the URL I needed returned. In this particular case, linking the logo to the website&#8217;s home page, regardless of the directory WordPress is installed in, would require the usage of <code>home_url()</code> exclusively.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2673/add-a-home-page-link-to-your-logo-in-wordpress/feed/</wfw:commentRss> <slash:comments>0</slash:comments> </item> <item><title>Write a Simple Plugin to remove the Excess 10px added to WordPress Image Captions</title><link>http://www.wearepixel8.com/2592/write-a-simple-plugin-to-remove-the-excess-10px-added-to-wordpress-image-captions/</link> <comments>http://www.wearepixel8.com/2592/write-a-simple-plugin-to-remove-the-excess-10px-added-to-wordpress-image-captions/#comments</comments> <pubDate>Sun, 28 Aug 2011 14:56:16 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[wordpress plugins]]></category> <category><![CDATA[wordpress theme development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=2592</guid> <description><![CDATA[We will show you a 5 minute solution to remove the excess 10px WordPress adds to image captions by creating your own simple WordPress plugin.]]></description> <content:encoded><![CDATA[<p>If you are a WordPress theme developer, or have ever used the WordPress image caption shortcode, you have inevitably noticed that the shortcode returns an inline CSS style that adds an excess 10px width to the wrapping div. I&#8217;m not well versed on why the core WordPress developers decided on this direction, but have run into occasions when this is in direct conflict with my designs.</p><p>Let&#8217;s say you want to apply a caption to an image in the WordPress editor, whose dimensions are 300px wide. The inline style the shortcode will add to the wrapping div will be <code>style="width: 310px"</code> but I need the style to match the exact width of my image. How do we accomplish this without touching the core files?</p><p>Well, you can definitely add a new function to your functions.php file. But, if you are like me, you like to keep that file tidy and compact. Plus, I tend to want to write as few lines of redundant code as possible. Adding a function to this file means I would have to do so every time my theme design requires this bit of functionality. I am admittedly a bit too lazy for that which led me to the decision to come up with a simple plugin that the user can install and activate.</p><p>But the added beauty of this solution is its portability. The user can change themes but, as long as the plugin is activated the function is still active.</p><h2>Write your simple plugin.</h2><p>The code necessary to achieve our end goal is quite simple. We are going to use the <code>add_filter</code> hook to modify the image shortcode output. <em>(Note: You can refer to the <a
title="WordPress Codex: Function Reference/add filter" href="http://codex.wordpress.org/Function_Reference/add_filter">WordPress Codex</a> for detailed information about this particular hook and its usage.)</em> We are also going to make this a drop-in plugin, so we will need to include the standard plugin headers that will provide the meta information about the plugin.</p><h3>Step 1: Add your header information.</h3><p>Open your favorite code editor and create a new file and name it whatever you would like. In our case, we will name our file “wap8-imagecaption.php.” As far as file naming conventions go, I find it best to be as precise as possible. I also always append a prefix, which is just an abbreviation of the studio&#8217;s name, so I keep track of files I&#8217;ve created.</p><p>In your newly created file, you are going to add the following:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
Plugin Name: Image Caption Shortcode Fix
Plugin URI: http://www.wearepixel8.com
Description: This plugin will remove the additional 10px added to the WordPress image caption shortcode.
Version: 1.0
Author: We Are Pixel8
Author URI: http://www.wearepixel8.com
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>This is all pretty straight forward information. We have the plugin&#8217;s name, version number and author. If you were to upload this file now to your plugin directory, you will see that it has been added to the list of available plugins.</p><p><a
class="grande" title="Image Caption Plugin Screenshot" href="http://cdn.wearepixel8.com/wp-content/uploads/2011/08/imgcaption-plugin-screenshot.jpg"><img
class="alignnone size-medium wp-image-2597" title="Image Caption Plugin Screenshot" src="http://cdn.wearepixel8.com/wp-content/uploads/2011/08/imgcaption-plugin-screenshot-510x143.jpg" alt="Image Caption Plugin Screenshot" width="510" height="143" /></a></p><p>This is great, but we still need to tell WordPress what to do with this plugin once it is activated.</p><h3>Step 2: Add the function.</h3><p>Just below the header information, add the following function before the closing PHP tag:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'img_caption_shortcode'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wap8_img_caption'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wap8_img_caption<span style="color: #009900;">&#40;</span><span style="color: #000088;">$nowt</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attr</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span> shortcode_atts<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'align'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignnone'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'caption'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attr</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">1</span> <span style="color: #339933;">&gt;</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">||</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$caption</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$id</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'id=&quot;'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; '</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;div '</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'class=&quot;wp-caption '</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$align</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; style=&quot;width:'</span> <span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span> <span style="color: #000088;">$width</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'px;&quot;&gt;'</span> <span style="color: #339933;">.</span> do_shortcode<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$content</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;p class=&quot;wp-caption-text&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$caption</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/p&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>As I mentioned earlier, the function would be short, sweet and to the point. In an oversimplified explanation, we are adding a filter to the WordPress <code>img_caption_shortcode</code> function with our own <code>wap8_img_caption</code> function which tells WordPress to return the exact width of the image for the inline style.</p><p>All you have to do now is save the file and upload it to your plugin directory.</p><h2>Activate your plugin</h2><p>With your newly minted plugin uploaded, navigate to the Plugins settings of your WordPress installation and activate. You can test the plugin by inserting and image, with caption, to a post or page and publish. View your published page and make sure to inspect the source code of the page. You should now see something like the following:</p><p><a
class="grande" title="Image Caption Source Code Screenshot" href="http://cdn.wearepixel8.com/wp-content/uploads/2011/08/imgcaption-source-screenshot.jpg"><img
src="http://cdn.wearepixel8.com/wp-content/uploads/2011/08/imgcaption-source-screenshot-510x201.jpg" alt="Image Caption Source Code Screenshot" title="Image Caption Source Code Screenshot" width="510" height="201" class="alignnone size-medium wp-image-2607" /></a></p><p>You will now notice that the wrapping div&#8217;s inline style width matches the exact width of the image. We have successfully removed the additional 10 pixels added by WordPress.</p><p>That&#8217;s it. I hope you find this to be useful. Happy developing and happy publishing.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2592/write-a-simple-plugin-to-remove-the-excess-10px-added-to-wordpress-image-captions/feed/</wfw:commentRss> <slash:comments>8</slash:comments> </item> <item><title>Why Your Home Business Needs a Designer</title><link>http://www.wearepixel8.com/2395/why-your-home-business-needs-a-web-designer/</link> <comments>http://www.wearepixel8.com/2395/why-your-home-business-needs-a-web-designer/#comments</comments> <pubDate>Fri, 05 Aug 2011 20:01:00 +0000</pubDate> <dc:creator>Jeanette Fernandez</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[op ed]]></category> <category><![CDATA[small business]]></category><guid
isPermaLink="false">http://demo.wearepixel8.com/wap8/?p=2395</guid> <description><![CDATA[If your business doesn't have an online presence, you will exponentially increase the risk of losing potential customers to the competition who does.]]></description> <content:encoded><![CDATA[<p>In our tech-savvy world, the internet is it. More than likely, if you don’t have an online presence, you’ll lose business to a company that does. Case in point: I needed to hire a local contractor. I went online (not the yellow pages directory) and searched for contractors in my area. I hired one that performed the service I was looking for and received stellar reviews. Now, this doesn’t mean that there wasn’t another local business that did the same. It just means that the latter didn’t have an online presence.</p><p>There’s no way around it, if you’re going to start a home business, you’ll need a website. Let me rephrase: you’ll need a GOOD website. If the cost of investing in a website makes your cringe, think about all of the revenue you’ll be losing to a company with an existing site. And, your business may not need all the bells and whistles from the start.</p><p>So, let’s talk designers. This is definitely not the time to think you can design a logo and a site by reading a couple of books. Or, rely on your very limited Photoshop skills to get the job done. This is an investment in your business and should be treated as such. A professional experiences web and graphic designer can create a smashing logo and website that will meet your needs and provide you with the internet presence you require.</p><p>Of course, it can be a bit scary to rely on someone else to design your vision and represent your business. The last thing you want it to have a logo and/or website that looks nothing like you or meets your goals. Here are a few things you think about when searching for a graphic designer:</p><ol><li>A local designer you can meet in person will always be a plus, but don’t limit yourself. You may be surprised to find the designer/design studio you’re looking for to live in another state, or maybe even another country. Just because they’re local doesn’t mean they’re the best person for the job.</li><li>What types of services do they perform? And, are they good at it? Some designers prefer to do one type of service (website, logo, etc.). You’ll want to hire someone who is working with their strength. This can mean hiring a web designer to design and develop your website and a graphic designer to create your logo.</li><li>Is it all about you or them? Make sure your designer “gets” you and understands your vision and goals.</li><li>Perform your own background check by contacting their previous clients to get personal reviews and feedback. Some designers look good on paper but not so much when it comes to the actual work, customer service and client collaboration.</li><li>Never hire a designer/design studio without a working, signed contract. They should provide one to you before any work begins. Don’t shy away from having a lawyer look it over if you’re uncomfortable with any type of formal contract.</li></ol><p>Remember, if you can’t be seen online, you can’t be seen. Your business deserves to have a presence.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/2395/why-your-home-business-needs-a-web-designer/feed/</wfw:commentRss> <slash:comments>1</slash:comments> </item> <item><title>Change Image Opacity, on hover, with jQuery</title><link>http://www.wearepixel8.com/1704/change-image-opacity-on-hover-with-jquery/</link> <comments>http://www.wearepixel8.com/1704/change-image-opacity-on-hover-with-jquery/#comments</comments> <pubDate>Thu, 05 Aug 2010 00:59:31 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[javascript]]></category> <category><![CDATA[jquery]]></category> <category><![CDATA[web development]]></category> <category><![CDATA[website portfolio]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=1704</guid> <description><![CDATA[Using jQuery in this tutorial, you will learn how to change the opacity of the remaining images, in an unordered list, when the user is hovering over a single image.]]></description> <content:encoded><![CDATA[<p>Not long ago, I wrote a <a
title="Create a Filterable Portfolio Page in WordPress with jQuery" href="http://www.wearepixel8.com/blog/filterable-portfolio/">post</a> about how you can create a filterable portfolio, in WordPress, using a jQuery plugin. And, since I love the ability to create subtle nuances for the user, I decided to extend this tutorial and show you how to include a hover effect animation for your thumbnails.</p><h2>The goal</h2><p>What I want to achieve is actually quite simple and I am sure you have seen the effect before. When a user hovers over a thumbnail in the portfolio, I want the opacity value of the remaining images reduced to a percentage of my choosing while leaving the hovered image opacity at 100%. I first set out to conquer this subtle animation using CSS only but, with poor cross browser support for <code>opacity</code>, I only ended up with really bad hacks and workarounds.</p><p><img
class="size-full wp-image-1737 alignnone" title="Screenshot of jQuery Hover Animation" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/08/jqueryhover.jpg" alt="Screenshot of jQuery Hover Animation" width="540" height="351" /></p><p>Once the CSS experiment proved to be a failure, I knew that jQuery would be perfect for the task. And, how right I was. The code ended up being minimal (less than 10 lines) and I could retain my clean and lean markup.</p><p><a
class="post-button" title="View the Demo" href="http://www.wearepixel8.com/demos/portfolio-animation/">View Demo</a></p><h2>Step 1: Get the latest version of jQuery</h2><p>The first thing you want to always do is make sure you are running the latest version of jQuery on your site (version 1.4.2 as of the publication). You can do this by either <a
title="Download jQuery" href="http://docs.jquery.com/Downloading_jQuery">downloading</a> the most recent version and uploading the file to your server or by hotlinking to the latest version directly from a CDN (Content Delivery Network) like Google Ajax API. I prefer the latter. Simply add the following code between the opening and closing <code>&lt;head&gt;</code> tags of your document.</p><div
class="wp_syntax"><div
class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></pre></div></div><p>Note, if you are going to implement this tutorial, in a WordPress theme, you need to make sure you are correctly enqueueing jQuery and not following this particular step.</p><h2>Step 2: Write the HTML Markup and CSS Styles</h2><p>There is no need for me to spend much time designing and coding a complicated layout for this demo. Suffice to say, your portfolio list should semantically be wrapped in an unordered list. The design and presentation of your portfolio is left up to your imagination. For demo purposes, I have written the following HTML code:</p><div
class="wp_syntax"><div
class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">ul</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;portfolio-list&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;clear&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Koopon Website Design&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/koopon.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Koopon Website&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;210&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;140&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Patriot Pride Corp Logo Design&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/ppcorp.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Patriot Pride Corp Logo&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;210&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;140&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Mazaif Packagin Design&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/mazaif.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Mazaif Packaging&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;210&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;140&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">li</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;#&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Women Working Logo Design&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;images/womenworking.jpg&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Women Working Logo&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;210&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;140&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">li</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">ul</span>&gt;</span></pre></div></div><p>There is nothing overly special here. The <code>&lt;ul&gt;</code> gets an id name of &#8220;portfolio-list&#8221; and a class name of &#8220;clear&#8221;, which will clear the float at the end of the unordered list. Everything else is pretty straightforward. I will then add the following styles:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">clear</span> <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> inline-<span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
.<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">visibility</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">hidden</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;.&quot;</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#portfolio-list</span> li <span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">float</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">left</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#portfolio-list</span> li a<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#portfolio-list</span> li a<span style="color: #3333ff;">:visited </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span> <span style="color: #933;">5px</span> <span style="color: #993333;">solid</span> <span style="color: #cc00cc;">#4f8603</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">210px</span><span style="color: #00AA00;">;</span> <span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">140px</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#portfolio-list</span> li a<span style="color: #3333ff;">:hover</span><span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#portfolio-list</span> li a<span style="color: #3333ff;">:active </span><span style="color: #00AA00;">&#123;</span> <span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#315301</span><span style="color: #00AA00;">;</span> <span style="color: #00AA00;">&#125;</span></pre></div></div><p>All I have done here is <code>float</code> the list items to the left and given them a <code>margin</code> of 10px on the left and right sides. All of the list item links will have a 5px <code>border</code> of green that will change to a darker hue on <code>hover</code>. Lastly, you will notice my little &#8220;clearing fix&#8221;, which is most definitely a hack, but it works and I never leave home without it.</p><h2>Step 3: Write the jQuery to animate the portfolio</h2><p>The amazing part of this entire journey is that it will only take 8 lines of code to accomplish our goal by using the new <code>jQuery.delegate()</code> method. Add the following code to your javascript file and I will explain what is happening afterwords:</p><div
class="wp_syntax"><div
class="code"><pre class="javascript" style="font-family:monospace;">jQuery<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
     jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#portfolio-list&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">delegate</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;li&quot;</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">&quot;mouseover mouseout&quot;</span><span style="color: #339933;">,</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>e<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> 
          <span style="color: #000066; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>e.<span style="color: #660066;">type</span> <span style="color: #339933;">==</span> <span style="color: #3366CC;">'mouseover'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
               jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#portfolio-list li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">not</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dequeue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;0.3&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span> <span style="color: #000066; font-weight: bold;">else</span> <span style="color: #009900;">&#123;</span>
               jQuery<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">&quot;#portfolio-list li&quot;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">not</span><span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">this</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">dequeue</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">animate</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#123;</span>opacity<span style="color: #339933;">:</span> <span style="color: #3366CC;">&quot;1&quot;</span><span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span> <span style="color: #CC0000;">300</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
          <span style="color: #009900;">&#125;</span>
     <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>As you can see, we are targeting all of the <code>&lt;li&gt;</code> tags inside of <code>#portfolio-list</code> and attaching the <code>mouseover</code> and <code>mouseout</code> events using <code>jQuery.delegate()</code>. Now, if the user hovers over a list item, animate all of the of the other items by reducing their opacity to 30% over 300 milliseconds. The else statement returns the opacity back to 100%.</p><p>Normally, I would use <code>.stop()</code>, which would literally stop firing the animation if the user quickly hovered over another image causing all of the images to flicker. But <a
title="Visit Phil Salesses' Website" href="http://www.philsalesses.com">Phil Salesses</a> discovered some unwanted behavior when using my snippet in conjunction with the filtering plug in and discovered that <code>.dequeue()</code> would also halt the animation without interfering with the plug in.</p><h2>Conclusion</h2><p>There you have it. A very simple way to add a little interactivity to your portfolio with minimal amount of code. Be sure to check out the <a
title="View Demo" href="http://www.wearepixel8.com/demos/portfolio-animation/">demo</a> to see the script in action. Also, if anyone has a better script for this type of animation, please share in the comments.</p><p><a
class="post-button" title="View the Demo" href="http://www.wearepixel8.com/demos/portfolio-animation/">View Demo</a></p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/1704/change-image-opacity-on-hover-with-jquery/feed/</wfw:commentRss> <slash:comments>15</slash:comments> </item> <item><title>3 simple Image Enhancements in Photoshop</title><link>http://www.wearepixel8.com/1305/3-simple-image-enhancements-in-photoshop/</link> <comments>http://www.wearepixel8.com/1305/3-simple-image-enhancements-in-photoshop/#comments</comments> <pubDate>Fri, 22 Jan 2010 23:10:29 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[photo retouching]]></category> <category><![CDATA[photoshop tutorial]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=1305</guid> <description><![CDATA[Did you ever want to pull your hair out when clients deliver image assets that just won't do? Here are 3 really simple methods of sprucing up those drab images in Photoshop in less than 3 minutes.]]></description> <content:encoded><![CDATA[<p>Imagine this scenario. You have spent countless hours designing the perfect mock-up page for a client using placeholder images. Now it’s time to drop in the client’s assets to get that final approval so you can get down to coding. You extract the zip file that was just now delivered and your heart sinks. All of the photos were shot by a non-ace on a snap-shot digital camera! Some were out of focus (completely unusable) while the remaining photos were dull in color.</p><p>Let’s face it. It happens. Not every client can afford a professional photo shoot with a photographer that will deliver high quality images. And though you may have sternly recommended using a skilled individual for the task, it just may not be in their budget. And that is where you, as a designer, have to step in and work up some minor divination on those lifeless images.</p><p>I’m going to show you three very simple ways to enhance a digital photo in Photoshop. These are meant for screen use only and not intended for print production. Unless you are adept at photo retouching, I wouldn’t recommend using these methods on a document that is intended for print.</p><p>If you would like to follow along, download this <a
title="Download stock image" href="http://www.sxc.hu/photo/1233860" target="_blank">“Country road” stock image</a> from stock.xchng, but feel free to use any image you like. I am using this image for demonstration purposes only and am not saying the image represents what was described in the imagined scenario.</p><h2>Method 1: Use blending modes to enhance the color.</h2><p>Of the three methods, this one is the simplest. Open your image in Photoshop. From your Layers Palette window, drag a copy of the “Background” layer over the “Create a new layer” icon at the bottom of the palette window. This will automatically create a “Background copy” layer above the “Background” layer.</p><p><img
class="size-full wp-image-1307 alignnone" title="Make a layer copy" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/makelayercopy.jpg" alt="Make a layer copy" width="525" height="416" /></p><p>Now, select your “Background copy” layer and change the Blend Mode to Overlay. You should see a dramatic change in the colors of your image. In fact, the image might now be over saturated. Simply reduce the Opacity to about 70%, or until you reach your desired effect.</p><p><img
class="size-full wp-image-1308 alignnone" title="Change blend mode to overlay" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/overlayblendmode.jpg" alt="Change blend mode to overlay" width="525" height="416" /></p><p>Now you can see the differences between the original source image and the end result. You can adjust the effect by increasing or decreasing the Opacity slider. You can also play with other Blend Modes like Soft Light to quickly add a color pop to a drab digital image. It all depends on how dramatic of an effect you want in the end.</p><p><img
class="size-full wp-image-1309 alignnone" title="Overlay blend mode before &amp; after" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/colorbeforeafter.jpg" alt="Overlay blend mode before &amp; after" width="524" height="393" /></p><h2>Method 2: Change the mood of an image with a Curves adjustment layer.</h2><p>Here is a method I just picked up from a photographer and master photo retoucher that is often used in fashion photography (but in a more detailed manner than what I am going to show you). We are going to drastically boost specific colors by using a Curves adjustment layer.</p><p>First, let’s boost up the saturation of the image by clicking on the “Create new fill or adjustment layer” icon and selecting “Hue/Saturation&#8230;” from the Layers Palette window. In the newly opened dialog window drag the Saturation slider to 25.</p><p><img
class="size-full wp-image-1311 alignnone" title="Increase the saturation of colors in the image" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/huesaturation.jpg" alt="Increase the saturation of colors in the image" width="525" height="378" /></p><p>Return to your Layers Palette window and click on the “Create new fill or adjustment layer” icon again and select “Curves&#8230;”. This will add another adjustment layer directly above your Hue/Saturation adjustment layer.</p><p>For this image, I want to enhance the blue colors in the photograph. To do so, I will select the Blue channel from the drop down menu and create an “s” shaped curve. Make sure you have your Preview option on. Once I am happy with the output, I will click “Ok” and I am done.</p><p><img
class="size-full wp-image-1312 alignnone" title="Adjust the Curves on the blue channel" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/curvesadjustlayer.jpg" alt="Adjust the Curves on the blue channel" width="525" height="510" /></p><p>The beauty of this method is that it is non destructive to your source image. If you don’t like the effect, simply delete the adjustment layers and begin again.</p><p><img
class="size-full wp-image-1313 alignnone" title="Curves adjustment layer before &amp; after" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/curvebeforeafter.jpg" alt="Curves adjustment layer before &amp; after" width="524" height="393" /></p><h2>Method 3: Use High Pass filter and Blending Modes to sharpen a black &amp; white photo.</h2><p>You can quickly sharpen a dull black &amp; white photo, in Photoshop, using the High Pass filter. I am going to first desaturate this image to convert it into a black &amp; white photo by choosing Image &gt; Adjustments &gt; Desaturate. And just as we did in the previous method, I will create a copy of the “Background” layer.</p><p>With the “Background copy” layer selected, I will choose Filter &gt; Other &gt; High Pass which will open a dialog window for this filter.</p><p><img
class="aligncenter size-full wp-image-1315" title="Choose High Pass filter from Filter drop down menu" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/highpass.jpg" alt="Choose High Pass filter from Filter drop down menu" width="525" height="565" /></p><p>Make sure you have your Preview option checked so you can see what you are doing. Depending on how dramatic of an effect you want, adjust the slider and hit “Ok”. I set mine to a Radius of 6 pixels because I want to really bring out the shadows and midtones.</p><p><img
class="size-full wp-image-1316 alignnone" title="High Pass dialog window" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/highpasswindow.jpg" alt="High Pass dialog window" width="525" height="415" /></p><p>Now, with your “Background copy” layer selected, change the Blend Mode to Soft Lift leaving the Opacity at 100%. Make another copy of this filtered layer and change the Blend Mode to Hard Light and reduce the Opacity to 15%.</p><p><img
class="size-full wp-image-1317 alignnone" title="Black &amp; White image before &amp; after" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/bwbeforeafter.jpg" alt="Black &amp; White image before &amp; after" width="524" height="393" /></p><h2>Conclusion</h2><p>There are other, more detailed methods of enhancing your digital images in Photoshop. These are some of my quicker methods that can result in desirable final images. Play around with them on your own and see what you come up with. I firmly believe that experimenting always produces the best accidents.</p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/1305/3-simple-image-enhancements-in-photoshop/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Styling a simple Form using CSS3</title><link>http://www.wearepixel8.com/1263/styling-a-simple-form-using-css3/</link> <comments>http://www.wearepixel8.com/1263/styling-a-simple-form-using-css3/#comments</comments> <pubDate>Fri, 15 Jan 2010 19:06:36 +0000</pubDate> <dc:creator>Erik Ford</dc:creator> <category><![CDATA[Tips & Tutorials]]></category> <category><![CDATA[code snippets]]></category> <category><![CDATA[css3]]></category> <category><![CDATA[web development]]></category><guid
isPermaLink="false">http://www.wearepixel8.com/?p=1263</guid> <description><![CDATA[Though CSS3 properties are not yet widely supported, there is no harm in experimenting with what may eventually be the norm. In this tutorial, we style a web form with rounded corners, gradients and a shadow using only CSS.]]></description> <content:encoded><![CDATA[<p>Recently, I had a simple project of designing and developing a newsletter subscription form that was only going to be viewed on and iPhone or iPod Touch device. The form, and all of the inputs, would have nice rounded corners (which I am an admitted sucker for) and subtle gradients.</p><p><img
class="size-full wp-image-1267 alignnone" title="CSS3 Form Screenshot" src="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/formscreen.jpg" alt="CSS3 Form Screenshot" width="525" height="350" /></p><p>Normally, we would achieve all of these effects by slicing up our Photoshop mock-up into individual background images that would later be implemented using the CSS background property. But, since I knew this particular form would only been seen on the iPhone and iPod Touch Safari browser, I decided to have have some fun with CSS3 properties, via Webkit, and replicate the entire mock-up without using any images at all.</p><p>The end result came out quite nicely. If all current modern browsers supported CSS3 properties, we would have significantly quicker page loads and would need less images to do our presentational dirty work.</p><p>In this little tutorial, I will show you how I accomplished these effects and take it one step further to include the 3.6a version of Firefox.</p><p><a
class="post-button" title="View Demo" href="http://www.wearepixel8.com/demos/css3-webform/">View Demo</a></p><h2>Step 1: Mark up your form</h2><p>There is nothing spectacular about the mark up for the page. In fact, it is a simple form with three inputs (two text fields and a Submit button). There is also a <code>&lt;h2&gt;</code> tag for the title of the <del>form</del> page which is completely optionally. Open up your favorite code editor and add the following code to your page:</p><div
class="wp_syntax"><div
class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wrapper&quot;</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>Sign up for our Newsletter<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h2</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">form</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;simple-form&quot;</span> <span style="color: #000066;">action</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">method</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&quot;</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-1&quot;</span>&gt;</span>Name<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-1&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-1&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span> <span style="color: #000066;">for</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-2&quot;</span>&gt;</span>E-mail<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;</span>
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-2&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;input-2&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
&nbsp;
          <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;submit&quot;</span> <span style="color: #000066;">value</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Submit&quot;</span> <span style="color: #66cc66;">/</span>&gt;</span>
     <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">form</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span></pre></div></div><p>As you can see, there is nothing new here. You have your form, which we are assigning an id of <code>#simple-form</code>, form labels and inputs with assigned id&#8217;s of <code>#input-1</code> and <code>#input-2</code>. We are going to target each of these id&#8217;s in our next steps to produce gradients, rounded corners and a shadow.</p><h2>Step 2: Add some basic styles to your page.</h2><p>I recommend using a CSS reset file so you are always starting with a clean slate. If you do not have a reset file of your own, <a
title="Download CSS reset file" href="http://cdn.wearepixel8.com/wp-content/uploads/2010/01/reset.zip">download</a> ours and insert it into <del>the head of your document</del> the top of your stylesheet <strong>before</strong> <del>the call for your own stylesheet</del> the styles for the form. Once you have done this, add the following to your own stylesheet:</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">body<span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#ececec</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#565656</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">font</span><span style="color: #00AA00;">:</span> <span style="color: #933;">62.5%</span> Helvetica<span style="color: #00AA00;">,</span> Arial<span style="color: #00AA00;">,</span> <span style="color: #993333;">sans-serif</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #6666ff;">.wrapper</span> <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">320px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
h2 <span style="color: #00AA00;">&#123;</span>
     <span style="color: #000000; font-weight: bold;">font-size</span><span style="color: #00AA00;">:</span> <span style="color: #933;">2em</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span> <span style="color: #cc66cc;">0</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p>You will notice that I&#8217;ve also given the page a background color of light gray and set the typography to a universal <code>font-size</code> of 62.5% using Arial, Helvetica or next available sans-serif font. I&#8217;ve also set a universal color of dark gray for the all of the type. The <code>.wrapper</code> is here for demo and the tutorial purposes only.</p><h2>Step 3: Add the CSS3 magic to your form.</h2><p>Here is where the fun begins. To create the rounded corners, gradients and shadows that are available in CSS3, we have to use vendor specific extensions in conjunction with our original properties. Let&#8217;s add a background color of white to our form and a subtle shadow surrounding it. I am also going to give my form a <code>width</code>, <code>margin</code> and <code>padding</code> that is specific to this tutorial. What you want to pay attention to are the extensions that begin with <code>-webkit-</code> and <code>-moz-</code> targeting the Safari and Firefox browsers respectively.</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">form<span style="color: #cc00cc;">#simple-form</span> <span style="color: #00AA00;">&#123;</span>
     -moz-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
     -moz-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
     -webkit-border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
     -webkit-box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">10px</span> <span style="color: #cc00cc;">#ccc</span><span style="color: #00AA00;">;</span>
     border-radius<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
     box-shadow<span style="color: #00AA00;">:</span> <span style="color: #933;">20px</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span> <span style="color: #993333;">auto</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">25px</span> <span style="color: #933;">10px</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
     <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">260px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p>What we&#8217;ve done here is set the <code>border-radius</code> of all four corners to 20 pixels which will give us a nice round edge. What may not be as obvious is the <code>box-shadow</code> property. The shorthand declaration takes four attributes:</p><ul><li>The distance of the shadow on the x-axis (2px)</li><li>The distance of the shadow on the y-axis (2px)</li><li>The amount of blur radius to apply to the shadow (10px) with 0 being sharp</li><li>The color to apply to the shadow (very light gray)</li></ul><p>Now, let&#8217;s style the labels and inputs for the form. We are going to be using border-radius once again, but this time we are going to apply a gradient to the inputs as well.</p> <pre
lang="css"
form#simple-form label {
display: block;
font-size: 1.65em;
font-weight: bold;
letter-spacing: -0.025em;
margin: 0 0 5px 15px;
text-align: left;
}form#simple-form input#input-1, form#simple-form input#input-2 {
-moz-border-radius: 20px;
-webkit-border-radius: 20px;
border-radius: 20px;
background-color: #eaeaea;
background: -moz-linear-gradient(top, #ffffff, #eaeaea);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #ffffff), color-stop(1.0, #eaeaea));
border: 1px solid #cacaca;
color: #444;
font-size: 1.4em;
margin: 0 0 25px;
padding: 8px 10px;
width: 240px;
}form#simple-form input#submit {
-moz-border-radius: 32px;
-webkit-border-radius: 32px;
border-radius: 32px;
background-color: #dedede;
background: -moz-linear-gradient(top, #ffffff, #eaeaea);
background: -webkit-gradient(linear, left top, left bottom, color-stop(0.0, #ffffff), color-stop(1.0, #dedede));
border: 1px solid #dedede;
color: #484848;
font-size: 1.65em;
font-weight: bold;
padding: 10px 15px;
}
</pre><p>With the <code>-moz-linear-gradient</code> and <code>-webkit-gradient</code> attributes, we can replicate the gradients created in Photoshop right in the browser without any images. The two are slightly different from one another on how you implement them, but the effect is exactly the same.</p><p>For the <code>-webkit-</code> extension, you must establish the type of gradient <code>(linear)</code>, the starting point <code>(left top)</code>, the ending point <code>(left bottom)</code>, the <code>color-stop</code>, color value and origin point of the first color (white starting at the very top), and the same for the second color (gray starting that the end). For the <code>-moz-</code> extension, you can either use <code>-moz-linear-gradient</code> (in this case) or <code>-moz-radial-gradient</code>. For a simple gradient like this one, state the origin point and two colors and you are done.</p><h2>The Demo</h2><p>If you are browsing with either Safari 4 or Firefox 3.6a, you will be able to see CSS3 wizardry in action, which leads me to the caveat of this post. As of now, these properties are experimental and only a part of the CSS3 draft. Therefore, they are subject to change at any time. So, when you combine this with the lack of universal support, I recommend sticking to your tried and true methods for now or use them sparingly with a graceful degradation for unsupported browsers.</p><p><a
class="post-button" title="View Demo" href="http://www.wearepixel8.com/demos/css3-webform/">View Demo</a></p> ]]></content:encoded> <wfw:commentRss>http://www.wearepixel8.com/1263/styling-a-simple-form-using-css3/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk: basic
Page Caching using disk: enhanced
Database Caching 2/59 queries in 0.906 seconds using disk: basic
Object Caching 609/745 objects using disk: basic
Content Delivery Network via Rackspace Cloud Files: cdn.wearepixel8.com

Served from: www.wearepixel8.com @ 2012-02-04 14:19:12 -->
