<?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>larryaronson.com &#187; wordpress</title>
	<atom:link href="http://larryaronson.com/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://larryaronson.com</link>
	<description>Systems Psychoanalyst</description>
	<lastBuildDate>Thu, 10 May 2012 20:31:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3</generator>
		<item>
		<title>Sidebar Pages In WordPress</title>
		<link>http://larryaronson.com/2011/sidebar-pages-in-wordpress/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2011/sidebar-pages-in-wordpress/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 11:30:44 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Google Analytics]]></category>
		<category><![CDATA[menu manager]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Popular Posts]]></category>
		<category><![CDATA[sidebar widget]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[WordPress functions]]></category>
		<category><![CDATA[wordpress shortcodes]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1857</guid>
		<description><![CDATA[There are a lot of WordPress plugins that will put a <strong>Popular Posts</strong> widget in your blog's sidebar. But, they all return different results. Here's how to create a sidebar widget that will feature the posts you want to highlight.]]></description>
			<content:encoded><![CDATA[<h3>Creating a custom &#8220;Popular Posts&#8221; widget</h3>
<p>I have a blogging client who has a love-hate relationship with computing. This client publishes daily and has become quite adept at the mechanics of doing so, successfully building traffic and a solid following. But when it comes to handling the blog&#8217;s administrative tasks, my client balks, refusing to look at any of the admin level menus. &#8220;I don&#8217;t like being a person who knows just enough to be dangerous,&#8221; my client has said.</p>
<p>The latest request from this client was to list the blog&#8217;s <strong>most popular posts</strong> in the sidedbar. It&#8217;s a WordPress site and there are many plugins available that will provide a widget for this task. Most are based on comment count as this is the metric that WordPress stores with each post record in its database. Some of the more sophisticated plugins make API calls to other services, such as Twitter and Google, to gather ranking data.</p>
<p>But nothing worked quite right for this client who had become a proficient <strong>Google Analytics</strong> user as well as a ardent <strong>Twitter</strong> user. I couldn&#8217;t find a popular posts plugin that would reliably match my client&#8217;s own subjective sense of popularity. I finally sent an email saying: &#8220;You want your readers to see your best stuff, in that respect, the numbers can provide guidance but your own judgement is the best metric.&#8221; I promised to figure something out that would allow the selection and ranking of posts although I didn&#8217;t have a clue how.</p>
<p>One of the joys of computer programming comes from those moments when you recognize that the particular little problem you&#8217;re working on is just a special case of a larger, more interesting and easier to solve problem. In this case, the larger problem was how to enable a WordPress author to publish formatted content to a sidebar widget. If I could solve that problem then my client could simply edit a page containing an ordered list of titles linked to the most popular posts. These could easily be copied from other pages in the <strong>WordPress dashboard</strong>. The client wouldn&#8217;t  need any admin level privileges. All I had to do was setup a <strong>text widget</strong> with code that pulled in the content of a designated page — A sidebar page.</p>
<h3>How to build a WordPress sidebar page widget</h3>
<p>Rather than write a dedicated sidebar widget, which is kind of complicated even though the <a href="http://codex.wordpress.org/" target="_blank">WordPress codex</a> has several examples to copy and paste from, I decided to write a <strong>WordPress shortcode</strong> which could be used in a sidebar text widget. This shortcode could also be used in other posts or pages on the site — going again for the more general and easier solution.</p>
<p>To start with, I created a new static page with the title, &#8220;Popular Posts&#8221;. Before you do this and publish the new page, check to see if it will automattically appear in your navigation menus. If you&#8217;re using the <strong>Menu Manager</strong> (included in WordPress 3.0+,) you&#8217;re probably okay since there&#8217;s a setting for this that&#8217;s off by default. If your theme does not use the Menu Manager, you might want to make the new page a child of some other page to exclude it from your navigation.</p>
<p>Next, we have to write a function that will output the contents of a page. This is easy. WordPress provides a built-in function just for that purpose called, <em>get_page( )</em>. We are going to use a variant of that function, <em>get_page_by_title( )</em>, and pass the title of the page (instead of the ID) as a shortcode parameter. Here&#8217;s the code for the function:</p>
<pre><span style="color: #008000;">function my_show_page( $atts, $content = null ) {
    extract(shortcode_atts(array( 'title'=&gt;'' ), $atts));

    if ($title != '') {
        $page_data = get_page_by_title( $title );
        return $page_data-&gt;post_content;
    }
    else {
        return '';
    }
}</span>
</pre>
<p>The first two lines are the standard setup for a shortcode. The parameter, <em>$atts</em>, will contain the shortcode&#8217;s parameters. In our case this is the page&#8217;s title which is then extracted by the second line of the code. If no title is passed, it&#8217;s given an empty string value. Setting the variable <em>$content</em> to null allows us to place the simple shortcode:</p>
<p><span style="color: #008000;"><tt>[showpage title="Popular Posts"]</tt></span></p>
<p>wherever we want to display the content of the page &#8220;Popular Posts&#8221; .</p>
<p>The body of the function is a simple <em>if</em> statement that makes sure a title is provided, then goes and gets the content of that page and returns it. Note that the content is returned unfiltered. That is, it&#8217;s unaffected by any plugins (e.g: ShareThis) or other code that modifies content.</p>
<p>The function code goes into your theme&#8217;s <strong>function file</strong>,  <em>functions.php</em>. Make sure you backup this file before you make any changes!! The function code can go anywhere in the file (except, of course, inside of another function) provided that it&#8217;s inside a set of php tags.</p>
<p>The next step is to register the shortcode so that it&#8217;s available for use. This is just a short command that also goes in the theme&#8217;s function file:</p>
<p><span style="color: #008000;"><tt>add_shortcode('showpage', 'my_show_page');</tt></span></p>
<p>It can go either before or after the function. I usually place it after the function along with comments to guide any future programmers who may work on my clients&#8217; sites.</p>
<p>Next, we have to enable shortcodes in text widgets. This is not enabled by default in WordPress because of security concerns. Sidebar text widgets are places where people often embed code from outside sources. The concern is that such embeded code might contain a shortcode that could conflict with something else on your blog or otherwise do nasty stuff. This is usually not a problem for smaller, personal blogs, however, I&#8217;ll emphasize again the importance of backing up your theme&#8217;s functions file before making any changes. Here&#8217;s the command to enable shortcodes in text widgets:</p>
<p><span style="color: #008000;"><tt>add_filter('widget_text', 'do_shortcode');</tt></span></p>
<p>Add the above to your functions file, save it and test the blog in a separate browser window to be sure it&#8217;s still working. Errors in a theme&#8217;s functions file will usually crash the public portion of a WordPress blog, but will leave the admin dashboard in working order.</p>
<p>Lastly, add a text widget with the shortcode to your sidebar. Here&#8217;s a screenshot from my client&#8217;s site illustrating this.</p>
<p><img class="aligncenter size-full wp-image-1860" title="sidebar_page_widget" src="http://larryaronson.com/wp-content/uploads/sidebar_page_widget.png" alt="Text Widget with a shortcode" width="480" height="477" /></p>
<p>For your convenience, here&#8217;s the entire block of commented code that I added to my client&#8217;s function file:</p>
<pre><span style="color: #808080;">/**
* Create a shortcode to display a page's content
*/
//
// [showpage title="page_title"]
//</span>
<span style="color: #008000;">function my_show_page( $atts, $content = null ) {
    extract(shortcode_atts(array( 'title'=&gt;'' ), $atts));
    if ($title != '') {
        $page_data = get_page_by_title( $title );
        return $page_data-&gt;post_content;
    }
    else {
        return '';
    }
}</span>
<span style="color: #808080;">// register the shortcode</span>
<span style="color: #008000;">add_shortcode('showpage', 'my_show_page');</span>
<span style="color: #808080;">//
// Enable the use of shortcodes in text widgets.</span>
<span style="color: #008000;">add_filter('widget_text', 'do_shortcode');</span>
</pre>
<p>Now that we see how easy it is to get formatted content into a sidebar widget, perhaps you have some ideas on what can be done with custom shortcodes in sidebar widgets. If so, please share them by leaving a comment below. Thanks.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2011/sidebar-pages-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sekonic Blog Launched</title>
		<link>http://larryaronson.com/2010/sekonic-blog-launched/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/sekonic-blog-launched/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 18:28:25 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[CSS3]]></category>
		<category><![CDATA[featured image]]></category>
		<category><![CDATA[MacGroup]]></category>
		<category><![CDATA[photography]]></category>
		<category><![CDATA[twentyten]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1805</guid>
		<description><![CDATA[<p><a href="http://larryaronson.com/2010/sekonic-blog-launched/"><img class="alignleft size-thumbnail wp-image-1806" title="Sekonic_snapshot" src="http://larryaronson.com/wp-content/uploads/Sekonic_snapshot.jpg" alt="Sekonic Blog - front page" width="75" height="60" /></a>I had the pleasure once again of working with Matt Hill of <a href="http://www.macgroupus.com/" target="_blank">MacGroup USA</a> to create a WordPress blog for one of their clients, the <a href="http://www.sekonic.com/" target="_blank">Sekonic Company</a>, a premier manufacturer of photographic light meters. The <a href="http://blog.sekonic.com/">Sekonic Blog</a> uses a custom child theme derived from the Twentyten WordPress theme and incorporates <em>Featured Images</em> and customized excerpts to give post authors more control of what appears on the blog's front page. The site also uses advanced CSS3 properties to create rounded corners, drop shadows and transition effects</p> 
]]></description>
			<content:encoded><![CDATA[<p>I had the pleasure once again of working with Matt Hill of <a href="http://www.macgroupus.com/" target="_blank">MacGroup</a>. I had previously rebuilt the <a href="http://larryaronson.com/2010/profoto-usa-rebuilt/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed" target="_blank">Profoto-USA blog</a> for them and this new project was a blog for another of their clients in the world of photography: the <a href="http://www.sekonic.com/" target="_blank">Sekonic Company</a>, a premier manufacturer of photographic light meters.</p>
<p><a href="http://blog.sekonic.com/"><img class="alignleft size-full wp-image-1806" title="Sekonic_snapshot" src="http://larryaronson.com/wp-content/uploads/Sekonic_snapshot.jpg" alt="Sekonic Blog - front page" width="300" height="236" /></a>It was a rather quick project thanks to the detailed Photoshop document provided as a spec for the front and single post pages. I started by creating a child theme from WordPress&#8217;s default <strong>Twentyten </strong>theme. The advantage of using a child theme is that all of your theme modifications are isolated in the child theme directory and are preserved when the theme is updated. Knowing that the way WordPress handles images in due for a revision in an upcoming version, I wanted to position Sekonic&#8217;s blog to take advantage of any new image handling features WordPress introduces via the default theme.</p>
<p>This was the first blog on which I implemented a <em>Featured Post</em> capability and I combined that with one of my favorite theme mods: the <em>excerpt switch</em>, to provide the post author with finer control of what appears on the blog&#8217;s front page. If a post has a featured image, then the medium-sized version of that image appears on the front page above the post&#8217;s body or excerpt. A featured image can be one of the images appearing in the post, an image from the site&#8217;s Media Library or an external image referenced by a URL.</p>
<p>Matt also gave me the freedom to use CSS3 on the blog to create the rounded corners and drop shadows in the design spec. To achieve these kinds of effects without using the CSS3 border-radius and box-shadow properties, a designer must create three overlapping division elements with different background images for the top, bottom and sides of a box. With CSS3, only a single element is needed and no background images have to be loaded. The disadvantage is that border-radius and box-shadow are recognized by the current versions of Firefox, Safari, Opera and Chrome but not by Internet Explorer. IE9, now in beta release, does support these properties so it&#8217;s only a matter of a few months time before IE users get the full design treatment.</p>
<p>Then, just for fun, I added <strong>CSS3 transitions</strong> to the navigation tabs. The idea behind CSS3 transitions is that when an element&#8217;s property changes (e.g: the background and text color of an navigation tab when the mouse hovers over it, ) the duration and other aspects of the transition can be controlled.  For the Sekonic Blog&#8217;s navigation tabs, I specified a 1.5 second duration from the base state (dark background, light-blue text) to the hover state (gray background, white text with drop-shadows) to visually reflect the blog&#8217;s tagline: &#8220;Control Light&#8221;.</p>
<p>I hope you enjoy the Sekonic blog. Building a website with such good writing and compelling images was a real pleasure for me.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/sekonic-blog-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>New Oradell Website Launched</title>
		<link>http://larryaronson.com/2010/new-oradell-website-launched/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/new-oradell-website-launched/#comments</comments>
		<pubDate>Thu, 21 Oct 2010 21:16:14 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[events manager]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[veterinary website]]></category>
		<category><![CDATA[wordpress shortcodes]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1327</guid>
		<description><![CDATA[<p><a href="http://larryaronson.com/2010/new-oradell-website-launched/"><img class="alignleft size-thumbnail wp-image-1331" title="Oradell-Animal-Hospital" src="http://larryaronson.com/wp-content/uploads/Oradell-Animal-Hospital-188x320.png" alt="Oradell Animal Hospital website screenshot" width="75" height="128" /></a>Oradell Animal Hospital of Paramus New Jersey is one of the largest and best animal and pet care centers in the world. But its website was old and they were losing the graphics designer who did their updates. Their marketing director was looking for new ways to connect with their current clients and customer base. I recreated their current site's structure and design in Wordpress with custom page templates, adding social sharing and other functionality with plugins, shortcodes and widgets.</p>]]></description>
			<content:encoded><![CDATA[<p><a href="http://larryaronson.com/wp-content/uploads/Oradell-Animal-Hospital.png#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><img class="alignleft size-medium wp-image-1331" title="Oradell-Animal-Hospital" src="http://larryaronson.com/wp-content/uploads/Oradell-Animal-Hospital-188x320.png" alt="Oradell Animal Hospital website screenshot" width="188" height="320" /></a>Oradell Animal Hospital of Paramus, New Jersey is one of the largest and best animal and pet care centers in the world. But its website was old and the graphics designer who did their updates was closing her shop and leaving the country.</p>
<p>Their marketing director was looking for new ways to connect with their current clients and customer base but didn&#8217;t have to budget to do a full redesign of their web site. Recreating the current site&#8217;s structure and design in WordPress, adding social sharing and other functionality with plugins and widgets  looked like the solution but there would be challenges in the project.</p>
<ul>
<li style="clear: left;">There were over 300 html files on the existing site without much organization. A major overhaul of the web site had apparently been done 6 or 7 years ago but the earlier generation of files had not been deleted. Internal links and navigation menus were a mess.</li>
<li>A two column front page that pulled post lists from different categories needed to be built and it had to be editable by the client. Templates for other special page types would need to be created. </li>
<li>Oradell needed a way to manage their busy calendar of events which included everything from special lectures to pet bereavement group session at multiple locations.</li>
<li>A large amount of content had been collected over the years that needed curating and conversion including profiles and pictures of 100 doctors and staff. I would need to duplicate their doctor-popup windows.</li>
</ul>
<p>Lisa Davis, Oradell&#8217;s director of marketing and I worked our way through the content sorting the pages into a navigable hierarchy. We played with the front page&#8217;s features and layout over the course of the project until it finally looked and felt right. I built a special template for the <em>Services &amp; Staff</em> pages that included a dynamically generated menu of all of the hospital&#8217;s departments. Each department&#8217;s page is a child page of the <em>Services &amp; Staff</em> page.</p>
<p>I installed the <a href="http://wordpress.org/extend/plugins/events-manager/" target="_blank">WordPress events manager</a>. This is a powerful piece of programming. It&#8217;s highly configurable and easy to use but, otoh, required a lot of configuration for Oradell&#8217;s requirements.</p>
<p>The most fun was writing shortcodes – one to show posts from a specific category in the content of a page and another to insert a doctor or staff profile in a post or page. The first  shortcode:</p>
<pre>[showposts category="featured" display="title"]</pre>
<p>in the content of a page produces a listing of permalinked post titles in the &#8220;featured&#8221; category. The other choices for the display option are &#8220;excerpt&#8221; and &#8220;post&#8221;. These are used throughout the site.</p>
<p>The doctor shortcode was more complicated because doctor information needed to be displayed in different contexts with different requirements: in the body of a post, on the various departments pages and in the complete directory of personnel. For each doctor or staff member, the profile consisted of the person&#8217;s name, academic credentials, job title, image and bio. Since several of their doctors were interested in blogging, I decided to register all the doctors and staff as blog contributors and use the extra IM user fields to store the titles and credentials. For example, using this shortcode in a post:</p>
<pre style="font-size: small;">[doctor name="John Dolittle" role="true" creds="true" hide="false"]</pre>
<p>will cause Dr. Dolittle&#8217;s (not an real Oradell employee) complete profile to be inserted, including his credentials and job title following his name plus the bio with a left-aligned photograph. Setting the <em>hide</em> parameter to &#8220;true&#8221; will hide the bio and photo but with a jQuery toggle, Somewhat like this:</p>
<div style="font-size: small; padding: .5em 1em; border: thin solid pink;">
<h4><a onclick="$('#dolittle-bio').toggle('slow');return false;">John Dolittle</a>, DVM, MD – Chief of Staff</h4>
<div id="dolittle-bio" style="display: none; padding-top: 1em;"><img class="alignleft size-thumbnail wp-image-1347" title="Photos from Doctor Dolittle" src="http://larryaronson.com/wp-content/uploads/Photos-from-Doctor-Dolittle-150x143.png" alt="" width="150" height="143" />Dr. John Dolittle lives in a little town called, Puddleby-on-the-Marsh in a little house on the edge of the town. The house was quite small; but his garden was very large and had a wide lawn and stone seats and weeping-willows hanging over. He is very fond of animals and keeps many kinds of pets. Besides the gold-fish in the pond at the bottom of his garden, he has rabbits in the pantry, white mice in his piano, a squirrel in the linen closet and a hedgehog in the cellar.</div>
</div>
<p>All in all, I liked working on the new Oradell website. It presented interesting challenges and the people I worked with were wonderful.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/new-oradell-website-launched/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Reimagine America</title>
		<link>http://larryaronson.com/2010/reimagine-america/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/reimagine-america/#comments</comments>
		<pubDate>Wed, 20 Oct 2010 19:42:24 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Joyce Cordi]]></category>
		<category><![CDATA[MENG]]></category>
		<category><![CDATA[MistyLook Theme]]></category>
		<category><![CDATA[podcasting]]></category>
		<category><![CDATA[PodPress]]></category>
		<category><![CDATA[Skype]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1575</guid>
		<description><![CDATA[<p><a href="http://larryaronson.com/2010/reimagine-america/"><img class="alignleft size-thumbnail wp-image-1583" title="Reimagine_America.org" src="http://larryaronson.com/wp-content/uploads/Reimagine_America.org_-191x320.jpg" alt="Reimagine America - front page" width="75" height="126" /></a>I just finished this site for <a href="http://cordiconsulting.com/" target="_blank">Joyce Cordi</a>, a management and business consultant based in San Jose, California. Joyce is passionate about politics and publishes podcasts speaking out about government waste and absurdities. She wanted a customized front page that pulled in content from her about and bio pages along with selected posts on various topics. I used a combination of custom page templates and shortcodes for her new WordPress website.]]></description>
			<content:encoded><![CDATA[<p><a href="http://reimagineamerica.org/"><img class="alignleft size-medium wp-image-1583" title="Reimagine_America.org" src="http://larryaronson.com/wp-content/uploads/Reimagine_America.org_-191x320.jpg" alt="Reimagine America - front page" width="191" height="320" /></a>A good friend recommended me for a &#8220;need a website developer&#8221; post on the The <a href="http://mengonline.com" target="_blank">Marketing Executives Networking Group</a> (MENG) list. The poster was <a href="http://cordiconsulting.com/" target="_blank">Joyce Cordi</a>, a management and business consultant based in San Jose, California. Joyce is passionate about politics and ran for Congress in 2008. An outspoken advocate for sense in government, she had started her <a href="http://reimagineamerica.org/" target="_blank">Reimagine America</a> blog on WordPress.com but wanted to move past the limitations of the free hosting service. She also wanted a customized front page that pulled in content from her <em>about</em> and <em>bio</em> pages along with selected posts on various topics.</p>
<p>Even though I gave her my standard disclaimer that I am an information architect, not a graphics designer, she gave me full reign on changing any design elements. &#8220;Just don&#8217;t make me look at a bunch of themes!&#8221; was her only requirement.</p>
<p>&#8220;That&#8217;s fine.&#8221; I replied. &#8220;you&#8217;re already using the MistyLook theme which I like so much that I&#8217;ve used it on my own site.&#8221; All that was needed design-wise was a change from MistyLook&#8217;s muted grays and greens to patriotic reds, whites and blues.</p>
<p>The big unknown in estimating the time and cost of this project was podcasting. The vast majority of Joyce&#8217;s posts consist of transcripts following an audio player control. Joyce complained about the difficulty she and her producer, Wayne, had in getting each podcast attached to a WordPress.com post. I hadn&#8217;t done much work with podcasts so I couldn&#8217;t tell if the problems stemmed from her methodology or from a problem with WordPress.com itself. The only way to find out was to copy one of her audio files and try to setup podcasting on my development site.  I started with <a href="http://wordpress.org/extend/plugins/podpress/" target="_blank">PodPress</a>, one of the more popular podcasting plugins. It worked like a charm.</p>
<p>Building a replacement WordPress site is not as straight forward as it might seem. A WordPress installation internalizes its URL. By that I mean the site&#8217;s full URL is stored in the database in several places and this complicates creating a new WordPress instance on any address other than the final production URL. There are two ways around this problem, both of which present difficulties.</p>
<ol>
<li>Build the site on a temporary URL and convert to the production URL at launch time.</li>
<li>Modify the local DNS on a development machine in order to install the site on the production URL.</li>
</ol>
<p>The first approach is easier up to the conversion point. The conversion requires dumping the database, running it through a filter to change the internal URLs and reloading. It&#8217;s kind of scary since it essentially means killing and resurrecting the site, then waiting a few nail-biting hours for the DNS change to propagate across the Internet before you know if the conversion was successful or not.</p>
<p>The second approach is safer but  has the downside that the new site cannot be seen by the client unless she also has a spare machine on which she can modify her local DNS. Even if that&#8217;s the case, modifying your local DNS is not trivial, especially on a Windows PC where, if you don&#8217;t do it right, you can screw up your entire Internet access.</p>
<p>Still, whenever possible, I use the second approach and send emails with screenshots when I need the client&#8217;s input. I did this with Reimagine America but, instead of email, Joyce and I communicated using Skype, taking advantage of its screen sharing  and file transfers capabilities to work together on the design and layout.</p>
<p>For Reimagine America&#8217;s front page, I imported the showposts shortcode function I used on <a href="http://Oradell.com/" target="_blank">Oradell.com</a>. This allowed Joyce to choose which topics (WordPress categories) to feature, how many posts to show in each topic and whether to show just the title or the title and excerpt.</p>
<p><a href="http://reimagineamerica.org/articles/"><img class="alignright size-thumbnail wp-image-1584" title="Reimagine_America_articles" src="http://larryaronson.com/wp-content/uploads/Reimagine_America_articles-150x125.jpg" alt="Reimagine America Articles Page" width="150" height="125" /></a>As a bonus, I also copied the &#8220;Show All Articles&#8221; page that I developed for <a href="http://blog.Profoto-USA.com/" target="_blank">Profoto-USA</a> extending it with the ability to sort by category as well as by date and title. I find having a page with the full index of all post titles an important addition to any blog. Click on the screen shot to the right to see the page in action.  <br class="spacer_" /></p>
<p><br class="spacer_" /></p>
<p><br class="spacer_" /></p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/reimagine-america/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Profoto-USA rebuilt</title>
		<link>http://larryaronson.com/2010/profoto-usa-rebuilt/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/profoto-usa-rebuilt/#comments</comments>
		<pubDate>Wed, 04 Aug 2010 13:33:14 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[MAC Group]]></category>
		<category><![CDATA[Matt Hill]]></category>
		<category><![CDATA[Ron Egatz]]></category>
		<category><![CDATA[slideshow]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1202</guid>
		<description><![CDATA[<a href="/2010/profoto-usa-rebuilt"><img class="alignleft size-thumbnail wp-image-1209" title="profoto-usa screenshot" src="http://larryaronson.com/wp-content/uploads/blog.profoto-usa_screenshot.png" alt="Screen shot of Profoto-USA home page " width="75" height="63" /></a>Repairing and rebuilding Profoto-USA's blog on photographic lighting techniques and equipment. This was a fun job as I got to learn how to replace Wordpress 2 theme technology with WP 3.0 functions and features. ]]></description>
			<content:encoded><![CDATA[<p>Ron Egatz and I go back to the time before the Web. He is one of those all-around creatives who does writing, editing, photography, graphic design and some Web programming. He occasionally calls on me to solve some of the more technical problems he encounters. So I was pleased when he asked me to help one of his associates, Matt Hill of <a href="http://MacGroupus.com/" target="_blank">MAC Group</a>, who needed a blog repaired ASAP.</p>
<p>Someone had started a blog for <a href="http://blog.profoto-usa.com/" target="_blank">Profoto-USA</a> using a customized theme but left it an unfinished mess. The sidebar was all screwed up, the <em>more</em> tag wasn&#8217;t working, there were no social-sharing functions and no control over the main menu – to name just a few of the problems. Profoto-USA is about the importance of good <strong>photographic lighting</strong> with dozens of interesting articles (some of the best authored by Ron) illustrated with beautiful photographs. Please click the screenshot below to check it out.</p>
<p><a href="http://blog.ProFoto-USA.com/"><img class="alignright size-full wp-image-1209" title="profoto-usa screenshot" src="http://larryaronson.com/wp-content/uploads/blog.profoto-usa_screenshot.png" alt="Screen shot of Profoto-USA home page " width="250" height="210" /></a>Fixing the sidebar, installing social sharing widgets and enabling the WP 3.0 menu manager was straight forward. The real challenge was finding a way to give authors more control over the content. The <em>more</em> tag, mentioned above, provides the ability to place a marker in a post so that on the blog&#8217;s front page, the post is displayed up to the marker, followed by a link to the rest of the article. I got that working but it wasn&#8217;t enough to manage the huge amount of content. The beginning paragraphs of a post often do not make the best summary, especially with long magazine-style articles. WordPress provides the ability to hand-craft a article summary, called an <em>excerpt</em>, but this feature has to be coded into the theme. Some themes show post excerpts on their front page; some show full posts (up to the first more tag.) I decided to give Profoto-USA the choice of which to use on a per-post basis using a custom field.</p>
<p>The previous developer had hard-coded a modified <em>Recent Posts</em> sidebar widget that showed, for each post, the post title and a linked thumbnail image. The thumbnails are large: 304 x 190 pixels, and only the first two or three appeared &#8220;above the fold.&#8221; The obvious solution was to use a sideshow plugin that cycled through the thumbnail photographs. Now, I&#8217;ve used a number of such plugins before and the general problem with them is that they only do what the plugin author designed them to do plus whatever user configurable options that author cares to code in. Imho – most of them fall short. Since most of the code for fetching the post data was already working, I decided to use some jQuery to add the animation effects and navigation controls to make it into a sideshow  (<a onclick="$('#slide-show-example').toggle('slow');" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">click for nerdy technical details.</a>)</p>
<div id="slide-show-example" style="display: none; padding: 1em; border: thin solid; background-color: #f0fff7; font-size: .9em; line-height: 1.1em;">
<p style="text-align: right;">[<a onclick="$('#slide-show-example').toggle('slow');" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed"><em style="color: red;">close</em></a>]</p>
<p>The code in the sidebar generated a structure which looked like this:</p>
<pre>
&lt;div id="post-slides"&gt;
    &lt;div class="post-slide"&gt;  &lt;!-- first slide --&gt;
        &lt;a href=..." title="..."&gt;&lt;img ... /&gt;&lt;/a&gt;
        &lt;h3&gt;&lt;a href=".." title="..."&gt;...&lt;/a&gt;&lt;/h3&gt;
    &lt;/div&gt;

    &lt;div class="post-slide"&gt;  &lt;!-- second slide --&gt;
        ...
    &lt;/div&gt;

    ...
&lt;/div&gt;</pre>
<p>The <a href="http://jquery.malsup.com/cycle/" target="_blank">jQuery cycle plugin</a> will apply an effect successively to each first-level child element of a selected parent. The type of effect, the timing and other options are passed as parameters. So, all that had to be done to make the above into a slideshow was to place the following script element just after the above code in the sidebar template.</p>
<pre>&lt;script type="text/javascript"&gt;
    $(document).ready(function() {
        $('#post-slides').show().cycle({
            fx: 'fade',
            speed: 1000,
            timeout: 10000,
            next: '#next_slide',
            prev: '#prev_slide'
        });
    });
&lt;/script&gt;</pre>
<p>Besides <em>fade</em>, other effects include: <em>slideUp</em>, <em>slideDown</em>, <em>slideLeft</em> <em>slideRight</em> and many more. The <em>speed</em> and <em>timeout</em> options are given in miliseconds. The <em>next</em> and <em>prev</em> options are given the ids of elements that will serve as the slideshow controls. I positioned double angle brackets in the widget title with this code placed above the post-slides division:</p>
<pre>&lt;h4&gt;Recent Articles&lt;/h4&gt;
 &lt;div id="slideshow-nav"&gt;
   &lt;div id="prev_slide"&gt;
     &lt;a href="#" title="previous article"&gt;&amp;lt;&amp;lt;&lt;/a&gt;
   &lt;/div&gt;
   &lt;div id="next_slide"&gt;
     &lt;a href="#" title="next article"&gt;&amp;gt;&amp;gt;&lt;/a&gt;
   &lt;/div&gt;
 &lt;/div&gt;</pre>
<p>Here&#8217;s a closeup image of the slideshow.</p>
<p><img class="alignnone size-full wp-image-1213" title="Profoto slideshow" src="http://larryaronson.com/wp-content/uploads/Profoto_slideshow.png" alt="" width="346" height="284" /></p>
</div>
<p>This took much less time than I anticipated – less time than it would have taken to find and configure a plugin to the client&#8217;s specifications. With the extra time on my hands, I decided to give Profoto-USA a feature they didn&#8217;t ask for but felt the site definitely needed: <a href="http://blog.profoto-usa.com/?page_id=1972" target="_blank">an index to <em>all</em> articles</a> showing only the permalinked titles and the meta-info line with author and publication date. I added it to the footer menu without telling them about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/profoto-usa-rebuilt/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>onPhilanthropy.com Has A New Website</title>
		<link>http://larryaronson.com/2010/onphilanthropy-com-has-a-new-website/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2010/onphilanthropy-com-has-a-new-website/#comments</comments>
		<pubDate>Mon, 17 May 2010 14:36:47 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Arthemia]]></category>
		<category><![CDATA[CauseWired]]></category>
		<category><![CDATA[DotOrgJobs]]></category>
		<category><![CDATA[Philanthropy]]></category>
		<category><![CDATA[Tom Watson]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[widgets]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1179</guid>
		<description><![CDATA[<a href="http://onPhilanthropy.com/"><img class="alignleft wp-image-1180" title="onPhilanthropy.com front page" src="http://larryaronson.com/wp-content/uploads/onphilanthropy-150x125.png" alt="onPhilanthropy.com" width="150" height="125" /></a>I just finished a major project for Tom Watson, author of <a href="http://causewired.com/" target="_blank"><cite>CauseWired</cite></a>, converting his website, onPhilanthropy.com, from a custom CMS to Wordpress. The new site, built on the Arthemia Premium theme, features modifications enabling it to carry ads from multiple sources, RSS feeds from companion sites and customized widget titles.]]></description>
			<content:encoded><![CDATA[<p><a href="http://onPhilanthropy.com"><img class="alignleft size-thumbnail wp-image-1191" title="onphilanthropy" src="http://larryaronson.com/wp-content/uploads/onphilanthropy-150x125.png" alt="onPhilanthropy.com" width="150" height="125" /></a>I just finished a major project for Tom Watson, author of <a href="http://causewired.com/" target="_blank"><cite>CauseWired</cite></a>, converting his website, onPhilanthropy.com, from a custom CMS to WordPress. <a href="http://onphilanthropy.com" target="_blank">The new site</a> is built on the Arthemia Premium theme with modifications enabling it to carry ads from multiple sources.</p>
<p>This site was a blast to work on. I had done a couple of other small repair and rescue jobs for Tom. He is wonderful client; tech-savvy and patient, he pushed for solutions that stretched my skill set and forced me to learn new techniques. Some of the interesting features of onPhilanthropy.com include: customized widget headings, a revamped advertising manager, a Twitter slurp and feeds from companion sites such as, <a href="http://DotOrgJobs.com" target="_blank">DotOrgJobs.com</a>.</p>
<p>If you are in the dot-org space, please visit <a href="http://onphilanthropy.com" target="_blank">onPhilanthropy</a> and check out how good technology can advance good causes. And, of course, feedback is always welcomed.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2010/onphilanthropy-com-has-a-new-website/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Adding more content with less clutter</title>
		<link>http://larryaronson.com/2009/adding-more-content-with-less-clutter/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2009/adding-more-content-with-less-clutter/#comments</comments>
		<pubDate>Tue, 29 Dec 2009 21:46:47 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Featured]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[Advanced Tooltips]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[random quotes]]></category>
		<category><![CDATA[UI Tools]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=990</guid>
		<description><![CDATA[<a href="adding-more-content-with-less-clutter"><img width="75" height="75" src="http://larryaronson.com/wp-content/uploads/Kate-Nasser.png" alt="" class="alignleft wp-image-1047" /></a>For my client Kate Nasser's website, I made a number of changes to add more features &#38; content, reduce clutter and improve search engine optimization (SEO). This article shows how to use advanced tooltips to make suplimental information invisible until needed. ]]></description>
			<content:encoded><![CDATA[<p>There&#8217;s a fundamental conflict in web page design between content and clutter. We want more content to make our pages findable &amp; provide value to visitors while maintaining visually clear layouts so as not to frighten away seekers of simple truths. The key to solving this conundrum is to stop thinking of web pages as printed page emulators. A printed page is a fixed matrix of tiny colored dots (pixels) on a two-dimensional surface. A web page is a dynamic document object composed of multiple layers of interactive elements.</p>
<p><img id="kn1" class="alignright" src="http://katenasser.com/wp-content/themes/katenasser/screenshot.jpg" alt="" width="200" height="213" title="Kate Nasser's front page as of November, 2009" />My client, Kate Nasser – the people skills coach, has grown her consulting business by consistently adding content to her blog/website and by using <a href="http://twitter.com/katenasser">Twitter</a>, <a href="http://linkedin.com">LinkedIn</a> and <a href="http://www.youtube.com/user/KateNasser">youTube</a> to draw traffic. A recent SEO/SEM assessment of her site recommended adding more keyword-rich content and reducing some of front page&#8217;s  clutter.  This is what the page looked liked.</p>
<h3>Advanced Tooltips.</h3>
<p>We had a box on the right side of the content area listing a dozen &#8220;Needs&#8221; linked to different site pages or posts. With each need there was an associated comment (technically, a definition list.) We decided to move the box to the left side of the page (ahead of the straight text content,) placing the comment parts in tooltip boxes that appear as you mouse over the topic part. Kate was free to add more content to the hidden (only from humans) comment parts.</p>
<p>Tooltips are the little yellow boxes that appear when your mouse hovers over a link. The content of the tooltip box is taken from the title attribute of the HTML tag that creates the link. But ordinary tooltips are boring with fixed style and color; yellow wasn&#8217;t the best choice given the site&#8217;s aqua tones.</p>
<p>So, I installed <a href="http://flowplayer.org/tools/" target="_blank">JQuery Tools from Flowplayer.org</a> which has an easy to use, advanced tooltip tool. JQuery is a library of Javascript functions that make it easy to add dynamic behavior to Web page elements without having to worry about cross-browser incompatibilities. JQuery Tools is a free, lightweight tool collection that provides basic behaviors to attach to any page element. The Advanced Tooltip tool replaces the browser&#8217;s builtin tooltip and can be attached to any page element, not just links.</p>
<p>To make Advanced Tooltips work, you have to provide a page element with a unique id to hold the content. It doesn&#8217;t matter where it&#8217;s placed. The element, typically a division, is dynamically positioned near the moused-over element. The element is re-useable; you only need one holder element for all tooltips of a given style on a page. The tooltip is styled using Normal CSS so I was able to match the colors and typography of that section of the site&#8217;s front page.</p>
<h4 id="kn2" title="Click &lt;em&gt;expand&lt;/em&gt; to display the technical details of using advanced tooltips.  The &lt;em&gt;close&lt;/em&gt; link is at the end of the section.">Technical Details <small>(<a onclick="$('#TechDetails').slideDown();" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Expand</a>)</small></h4>
<div id="TechDetails" style="display:none; color:#666; font-size: 90%;">
<p>On KateNasser.com&#8217;s front page (id=2,) tooltips will be activated for all links that are inside level 3 headings in the css class, <em>need-title</em>. This bit of <span style="color: #993300;">HTML</span>, <span style="color: #008000;">PHP</span> and <span style="color: #0000ff;">jQuery</span> coding was added to the document head in the header template.</p>
<pre id="line21" class="SmallCode"><span style="color: #993300;">&lt;script src="http://cdn.jquerytools.org/1.1.2/jquery.tools.min.js"&gt;&lt;/script&gt;
&lt;script type="text/javascript"&gt;</span><span style="color: #008000;">
&lt;?php if (is_page("2")) { ?&gt;</span>
<span style="color: #0000ff;">    $(document).ready(function() {
        $("h3.need-title a").tooltip({ tip: "#TipBox",
                                       offset: [-25, 150],
                                       effect: 'fade' });
    });</span><span style="color: #008000;">
&lt;?php } ?&gt;</span>
<span style="color: #993300;">&lt;/script&gt;</span></pre>
<p>The first line brings in the jQuerytools library, including the latest version of jQuery. Flowplayer.org encourages developers to directly link to their high-performance server to get the latest version. However, you can also download the library and install in on your own site for more control.</p>
<p>The <span style="color: #008000;">PHP</span> code makes sure that the tooltip code is executed only on the page we want it to. And, the <span style="color: #0000ff;">jQuery</span> code attaches the tooltips to their triggers and provides some options. JQuery does this after the document is fully defined and &#8220;ready&#8221;. This is typical of jQuery usage.</p>
<p>The holding container is defined in <span style="color: #993300;">HTML</span> at the end of content using the WordPress editor. All it contains is a non-breaking space. Note how the jQuery code above refers to this element using a CSS selector syntax.</p>
<pre id="line314" class="SmallCode"><span style="color: #993300;">&lt;div id="TipBox" class="needs-tips"&gt;&amp;nbsp;&lt;/div&gt;</span></pre>
<p>Finally, in the template style sheet, <em>styles.php</em>, the following <span style="color: #800080;">CSS</span> style rules are used:</p>
<pre class="SmallCode"><span style="color: #800080;">#TipBox {
 display:none;
 width: 200px;
}</span></pre>
<pre class="SmallCode"><span style="color: #800080;">.needs-tips {
 text-align: left;
 background-color: #fafcfb;
 border: 2px solid #009ea0;
 font: italic 10pt comic sans ms;
 color: #000;
 padding: 3px 8px;
}
</span></pre>
<p align="right" id="kn3" title="This expand/collapse behavior is another example of jQuery UI tools.">(<a onclick="$('#TechDetails').slideUp();" href="javascript:void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Close</a>)</p>
<hr size="1" /></div>
<h3>Random Quotes</h3>
<p>Kate has a bunch of her own quotes and was updating her front page every few days with a new quote from the collection. She asked if there were some way to automate the process. I browsed the various code and plugin collections and found noting simple or suitable. I decided to write my own.</p>
<p><a href="http://katenasser.com"><img id="kn4" title="This is Kate Nasser's new front page with more content and less clutter." src="http://larryaronson.com/wp-content/uploads/Kate-Nasser.png" alt="" title="Kate Nasser" width="200" height="220" class="alignleft size-full wp-image-1047" /></a>I copied her front page as a new draft page and cloned the default page template and assigned it to the new page. Thus, I was able to work on and test the new features without endangering the site&#8217;s current front page.  The cloned template would contain custom code to randomly pick a quote and place it at the beginning of the content area. The quotes themselves would be stored (and editable) as custom fields for that page with the key, &#8220;quote&#8221;.</p>
<pre class="SmallCode"><span style="color: #008000;">&lt;?php
    $todaysquote = '';
    $quotes = get_post_meta('2', 'quote');
    if (!empty($quotes)) {
        $todaysquote = $quotes[rand(0, sizeof($quotes) - 1)];
    }
?&gt;
</span><span style="color: #993300;">&lt;div class="dailyquote"&gt;&amp;ldquo;</span><span style="color: #008000;">&lt;?php _e($todaysquote); ?&gt;</span><span style="color: #993300;">&amp;rdquo;
&lt;span&gt;&amp;mdash;</span>Kate Nasser<span style="color: #993300;">&lt;/span&gt;&lt;/div&gt;</span></pre>
<p>First, a <span style="color: #008000;">PHP</span> variable, <em>$todaysquote</em>, is initialized. Then the WordPress function, <em>get_post_meta()</em>, gets all custom fields from post number 2 (that&#8217;s the front page) with key = &#8216;quote&#8217;. The values are returned as an array of strings and assigned to the variable, <em>$quotes</em>. If it&#8217;s not empty, the built-in, PHP random number generator picks one of its array items. Finally, the last two lines define the <span style="color: #800000;">HTML</span> division element that will hold the quote,  enclosing it in smart quote marks and adding Kate&#8217;s signature. Note the use of the special echo function,  <em>_e($todaysquote)</em>,  to encode any HTML characters that might be in the quote string.</p>
<p>One of the upsides of this technique is that a new front page is seen in most every visit to the front page including those by search engine robots. Over time, this can expand the number of keywords associated with the page. Unfortunately, there&#8217;s no easy way to measure which quotes work best. If you do add random content like this to a page, you should check to see if you have a caching plug-in active. You might want to exclude that page from the cache.</p>
<p>I added this feature as a template hack because my client only wanted it on one page which already had a customized template. It could be easily generalized and added as a filter to the theme&#8217;s functions file, for example, to append a random quote to post content when generating a single-post view.</p>
<div id="knTips" style="width:30%; border: 2px solid #900; background-color: #f6f6fc; color: #306; margin: 1em; padding: 1em; font-size: 90%;">&nbsp;</div>
<p><script type="text/javascript">$("#kn1,#kn2,#kn3,#kn4").tooltip({ tip: "#knTips", offset: [-25, -75] });</script></p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2009/adding-more-content-with-less-clutter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Air Safety And Law takes flight</title>
		<link>http://larryaronson.com/2009/air-safety-and-law/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2009/air-safety-and-law/#comments</comments>
		<pubDate>Wed, 14 Oct 2009 18:18:02 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[websites]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[author photos]]></category>
		<category><![CDATA[aviation]]></category>
		<category><![CDATA[David Schiffer]]></category>
		<category><![CDATA[Kreindler & Kreindler]]></category>
		<category><![CDATA[law]]></category>
		<category><![CDATA[wordpress filter]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=921</guid>
		<description><![CDATA[<a href="http://larryaronson.com/air-safety-and-law"><img class="alignleft wp-image-922" title="AirSafetyAndLaw" src="http://larryaronson.com/wp-content/uploads/AirSafetyAndLaw.jpg" alt="AirSafetyAndLaw" width="75" height="75" /></a>Air Safety And Law</strong> is intended to serve as a forum for the legal community to discuss air travel safety and liability issues. The blog is a project of <a title="Kreindler &#38; Kreindler" href="http://kreindler.com/" target="_blank">Kreindler &#38; Kreindler</a>, the law firm that handles most of the major aviation accidents.]]></description>
			<content:encoded><![CDATA[<p><a title="Air Safety And Law" href="http://airsafetyandlaw.com/" target="_blank"><img class="alignright size-full wp-image-922" title="AirSafetyAndLaw" src="http://larryaronson.com/wp-content/uploads/AirSafetyAndLaw.jpg" alt="AirSafetyAndLaw" width="250" height="250" /></a><strong>Air Safety And Law</strong> is intended to serve as a forum for the legal community to discuss air travel safety and liability issues. The blog is a project of <a title="Kreindler &amp; Kreindler" href="http://kreindler.com/" target="_blank">Kreindler &amp; Kreindler</a>, the law firm that handles most of the major aviation accidents. I originally worked on this in late 2007 with my graphics designer friend, <a title="David Schiffer Design" href="http://www.dlsdesign.com/" target="_blank">David Schiffer</a>, who provided the header image and selected the theme from several sample templates I presented. We put up a demo version on <a title="WordPress Free Hosting account" href="http://wordpress.com/" target="_blank">WordPress.com</a>, but not until recently have they decided to bring it live.  I moved the content to David&#8217;s managed server so that we&#8217;d be able to do robust search engine optimization and accommodate some modifications that would not be possible on WordPress.com.</p>
<p>As with another law firm blog I recently built, the Air Safety And Law authors wanted thumbnail versions of their portrait photos to appear with the articles they published.  Instead of hacking the template files as I had done with the previous site, however, I formalized the technique and wrote a WordPress filter. <a href="http://larryaronson.com/2009/add-author-photo-%e2%80%94-my-first-wordpress-filter/#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Read my recent article on how this works</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2009/air-safety-and-law/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Add Author Photo — My First WordPress Filter</title>
		<link>http://larryaronson.com/2009/add-author-photo-%e2%80%94-my-first-wordpress-filter/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2009/add-author-photo-%e2%80%94-my-first-wordpress-filter/#comments</comments>
		<pubDate>Fri, 09 Oct 2009 18:18:20 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[authors]]></category>
		<category><![CDATA[client]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[filters]]></category>
		<category><![CDATA[hooks]]></category>
		<category><![CDATA[image]]></category>
		<category><![CDATA[lawyer]]></category>
		<category><![CDATA[photos]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[Smashing Magazine]]></category>
		<category><![CDATA[websites]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=802</guid>
		<description><![CDATA[My client wanted to have their authors' photos appear with their published articles. In this article, I describe how I wrote a Wordpress filter – my first – to prepend an image to the content on the home and single post pages.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-871" style="padding-left: 0" title="your_photo_here" src="http://larryaronson.com/wp-content/uploads/your_photo_here.jpg" alt="your_photo_here" width="80" height="82" />The request was simple enough. I had just built a <a title="Air Safety And Law" href="http://airsafetyandlaw.com" target="_blank">WordPress blog for a law firm</a> and now they wanted to have their thumbnail photos in the articles they write. I had done this for <a title="Digital HHR" href="http://digitalhhr.com" target="_blank">another website</a> (also a law firm) a year ago, modifying each of the theme&#8217;s templates that displayed posts but, when I went back and looked at that code, I thought, &#8220;Too messy, there&#8217;s got to be a better way.&#8221;</p>
<p>A plug-in search turned up nothing. No surprise—Wordpress does not support user profile pictures natively. There&#8217;s no field in the database for an user&#8217;s image file name. Then I remembered reading an<a title="10 Useful WordPress Hooks" href="http://www.smashingmagazine.com/2009/08/18/10-useful-wordpress-hook-hacks/" target="_blank"> article in Smashing Magazine about filters</a> a couple of months ago. They had an example where a subscribe request was appended to the end of each post&#8217;s content. Maybe that technique would work to prepend a photo.</p>
<p>In WordPress, a filter is like a plug-in except for two important distinctions: It&#8217;s not packaged for distribution and it&#8217;s associated with the theme. That is, you can&#8217;t manage the filter from the dashboard&#8217;s plug-in manager and, if you change themes, it disappears. That was all right for my purposes. The clients were quite happy with the theme we&#8217;d chosen – <a href="http://wpthemes.info/misty-look/" target="_blank">Mistylook, by Sadish Bala</a> – and I could provide instructions on how to remove the filter from the theme&#8217;s functions file should they ever want to &#8220;deactivate&#8221; the feature.</p>
<p>I got the images from the client for the four lawyer/authors—a wallet-sized image and a thumbnail for each. The larger image would appear on the author&#8217;s profile page and the thumbnails would be placed at the beginning of their posts, floated left of the text. For the larger image, I modified the author&#8217;s template (<span style="font-family: andale mono,times;">author.php</span>) as I had with the previous website. For the thumbnails, I would use the filter approach since post content is accessed in several templates and I wanted a unified solution. For the sake of brevity, I&#8217;ll skip the part about the author template mods in this article. If you&#8217;re interested in that piece, leave a comment and I&#8217;ll write another article.</p>
<p>I created a new directory, <span style="font-family: andale mono,times;">/wp-content/authors</span> for the larger images and a sub-directory, <span style="font-family: andale mono,times;">/wp-content/authors/thumbs</span> for the smaller versions. In each, I renamed the images files to match the corresponding login usernames. If, for example, there was a user with the login username of &#8216;bobama&#8217;, then the two images files would be: <span style="font-family: andale mono,times;">/wp-content/authors/bobama.jpg</span> and  <span style="font-family: andale mono,times;">/wp-content/authors/thumbs/bobama.jpg</span> . I did this with an ftp program but you can use the dashboard&#8217;s Media manager, in which case, the image files will be somewhere in your <span style="font-family: andale mono,times;">/wp-content/uploads</span> directory with your other media files. All of the other work described in this article can be done through the dashboard&#8217;s theme editor by an admin user but I highly recommend using a good code editor with color syntax highlighting. <a href="http://bbedit.com/" target="_blank">BBEdit</a> is my favorite.</p>
<p>A WordPress filter goes into the theme&#8217;s functions file (<span style="font-family: andale mono,times;">functions.php</span>) and consists of two parts: A function definition and a call to add that function to a named WordPress &#8220;hook&#8221;. I called my function: <span style="font-family: andale mono,times;">add_author_photo() </span> and  added it to the &#8216;the_content&#8217; hook. You can think of this hook as the point in the page building process when WordPress gets the page or post content from the database and starts to get it in shape for the web page it&#8217;s building. WordPress passes the content to the function as a string and expects it back in return. Roughly, the outline of the process looks like this:</p>
<pre>&lt;?php
     function add_author_photo($content) {
         ...
         return $content;
     }</pre>
<pre>     add_filter('the_content', 'add_author_photo');
?&gt;
</pre>
<p>Note how the entire filter is enclosed in a PHP container. This is important!  Now, all we need to do is fill in the &#8220;dots&#8221;.</p>
<p>First, we need to make sure that our function does its work in the right place since it will be called anytime WordPress fetches the content from the database. We want the thumbnail photo to appear in posts on the home page and on single post pages, but not on static pages (which are, in a sense, &#8220;authorless&#8221;) nor on the archive and search result pages and especially not in RSS feeds. The following if statement does what we want:</p>
<pre style="padding-left: 30px;">if (is_home() || is_single()) {
    ...
}
</pre>
<p>Next, the code needs to check that the image file we want for the current post author actually exists. The client may add more authors and contributors before their photos are available and we don&#8217;t want an ugly, empty missing-image square to appear where a nice photo is expected. This is a bit tricky. There&#8217;s a PHP function,<span style="font-family: andale mono,times;"> file_exists()</span>, for checking whether a file exists or not but it takes, as its argument, the full Unix path to the file, as opposed to a URL fragment. WordPress provides a function for doing this: <span style="font-family: andale mono,times;">get_theme_root()</span> which returns a string that, depending on your hosting company&#8217;s site configuration, might look like this:</p>
<p style="padding-left: 30px;"><tt> </tt><span style="font-family: andale mono,times;">/var/web/clients/abc.com/htdocs/wp-content/themes</span></p>
<p>Since my &#8216;authors&#8217; directory is at the same level in <span style="font-family: andale mono,times;">/wp-content</span> as the themes directory, all I have to do is replace the &#8216;themes&#8217; part in the string above with &#8216;authors/thumbs/&#8217; and append the image&#8217;s file name. The following two lines of code will assign the username to a variable and do the replacement using  PHP&#8217;s  <span style="font-family: andale mono,times;">str_replace()</span> function.</p>
<pre style="padding-left: 30px;">$author_uname = get_the_author_meta('user_login');
$author_photo = str_replace(
                    'themes',
                    'authors/thumbs/' . $author_uname . '.jpg',
                    get_theme_root() );</pre>
<p>We can check whether the file exists with another if statement:</p>
<pre style="padding-left: 30px;">if (file_exists($author_photo)) {
    ...
}
</pre>
<p>Now we are ready to add the  image tag to the beginning of the post content. I&#8217;ll add a CSS class, &#8216;authorImage&#8217;, to the image tag which I&#8217;ll use to make the image float left and set appropriate margins and padding (see below.) I&#8217;ll also enclose the image in an anchor tag that links the image to the author&#8217;s profile page. I&#8217;ve laid this out here in several lines for readability. The dot at the end of each line is the PHP concatenation operator.</p>
<pre style="padding-left: 30px;">$image_src = '/wp-content/authors/thumbs/' .
             $author_uname . '.jpg';

$content =  '&lt;a href="/author/' .
            $author_uname .
            '"&gt;&lt;img class="authorImage" src="' .
            $image_src .
            '" alt="' .
            get_the_author() .
            '" /&gt;&lt;/a&gt;' .
            $content;</pre>
<p>Here&#8217;s a screenshot of the final code I pasted into the theme&#8217;s functions file. Because I&#8217;m a nice guy, I added  /* comments */ to explain what was going on. Click on the image to open a text division with the actual code you can copy.</p>
<p>[RAW]</p>
<p><img class="alignnone size-full wp-image-850" title="Click for text version" onclick="$('#imageText').slideDown();" src="http://larryaronson.com/wp-content/uploads/add_author_photo.jpg" alt="Click for text version" width="490" height="249" /></p>
<div id="imageText" style="border: 1px solid #666666; padding: 0.5em; display: none; width: 490px; font-size: 0.85em;">
<pre>&lt;?php
/*  Add authors' photos to posts on the home and single-post pages.
     Copyright 2009 Larry Aronson.

     For a post author identified by username, if the image file:
	/wp-content/authors/thumbs/username.jpg
     exists, it will be prepended to the content, floating left
     of the text and linked to the author's profile page		*/

function add_author_photo($content) {
  if(is_home() || is_single()) {
    $author_uname = get_the_author_meta('user_login');
    $author_photo = str_replace('themes',
         'authors/thumbs/' . $author_uname . '.jpg',
         get_theme_root());
    if (file_exists($author_photo)) {
	 $image_src = '/wp-content/authors/thumbs/' . $author_uname . '.jpg';
	 $content = '&lt;a href="/author/' . $author_uname .
             '"&gt;&lt;img class="authorImage" src="' .
	     $image_src . '" alt="' . get_the_author() . '" /&gt;&lt;/a&gt;' .
             $content;
     }
  }
  return $content;
}

/* remove the following line to deactivate the add photo feature */
add_filter('the_content', 'add_author_photo');
?&gt;
</pre>
<p><a onclick="$('#imageText').slideUp();" href="javascript: void(0);#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">click here to hide code.</a></p>
</div>
<p>[/RAW]</p>
<p>The final version took a bit of debugging to fix some stupid typing errors but it worked as I wanted it to. A look at the source code for the home page shows the generated image tag and link:</p>
<pre style="padding-left: 30px;">&lt;a href="/author/larryaronson"&gt;&lt;img class="authorImage"
   src="/wp-content/authors/thumbs/larryaronson.jpg"
   alt="Larry Aronson" /&gt;&lt;/a&gt;
</pre>
<p>All that remained was adding some simple CSS to the style sheet to float the image to the left of the post text. The rules shown below does that and sets appropriate margins.  The images already incorporated a border so I removed the border set elsewhere in the CSS and removed the drop shadow background that Mistylook adds to images as a matter of taste.</p>
<pre style="padding-left: 30px;">img.authorImage {
   float: left;
   margin: 0 1em 0 0;
   border: 0;
   padding: 0;
   background-image: none;
 }</pre>
<p>That&#8217;s it. I hope you found this article useful. Suggestions for improvements are welcome.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2009/add-author-photo-%e2%80%94-my-first-wordpress-filter/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Federal Criminal Practice Blog</title>
		<link>http://larryaronson.com/2009/federal-criminal-practice-blog/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2009/federal-criminal-practice-blog/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 14:16:39 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Portfolio]]></category>
		<category><![CDATA[websites]]></category>
		<category><![CDATA[wordpress]]></category>
		<category><![CDATA[crime]]></category>
		<category><![CDATA[David Schiffer]]></category>
		<category><![CDATA[Federal]]></category>
		<category><![CDATA[Gregory Poe]]></category>
		<category><![CDATA[law]]></category>
		<category><![CDATA[lawyer]]></category>
		<category><![CDATA[minimal]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=786</guid>
		<description><![CDATA[<a href="http://larryaronson.com/2009/federal-criminal-practice-blog/"><img class="alignleft size-thumbnail wp-image-790" title="Gregory Poe's Federal Criminal Practice Blog" src="http://larryaronson.com/wp-content/uploads/gpoelaw.screenshot.jpg" alt="Gregory Poe's Federal Criminal Practice Blog" width="75" height="63" /></a>Federal Criminal Practice Blog — I just completed another Wordpress blog for a client of my good friend and associate, David Schiffer, of DLS Design. David built a beautiful, static site for Gregory Poe, a lawyer in federal criminal law practice.]]></description>
			<content:encoded><![CDATA[<p><a href="http://blog.gpoelaw.com" target="_blank"><img class="alignleft size-thumbnail wp-image-790" title="Gregory Poe's Federal Criminal Practice Blog" src="http://larryaronson.com/wp-content/uploads/gpoelaw.screenshot-150x126.jpg" alt="Gregory Poe's Federal Criminal Practice Blog" width="150" height="126" /></a>I just completed another WordPress blog for a client of my good friend and associate, David Schiffer, of <a href="http://dlsdesign.com" target="_blank">DLS Design</a>. David built a beautiful, static site for Gregory Poe, a lawyer in federal criminal law practice,  and trusted me to copy his look and feel for the dynamic blog section. The static part of the site featured variable-width left and right margins with an image mapped navigation bar, so I selected my favorite variable-width theme, <a title="Minimal by Sadish Bala from The WordPress Theme Shop" href="http://wpthemeshop.com/" target="_blank">Minimal</a>, and reconfigured his menu as a WordPress style list so that any new pages Gregory created in WordPress would be automatically added to the navigation elements.</p>
<p>Once Gregory started posting on <a href="http://blog.gpoelaw.com" target="_blank">blog.gpoelaw.com</a>, we realized that his style of writing detailed legalese needed some additional typographic punch so we darkened the text and block justified the paragraphs for additional readability. Under the hood, I added my standard mix of plugins for SEO, Google Analytics and advanced editing.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2009/federal-criminal-practice-blog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

