<?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; lawyer</title>
	<atom:link href="http://larryaronson.com/tag/lawyer/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>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>
		<item>
		<title>Lawyers In New Media</title>
		<link>http://larryaronson.com/2008/lawyers-in-new-media/#utm_source=feed&#038;utm_medium=feed&#038;utm_campaign=feed</link>
		<comments>http://larryaronson.com/2008/lawyers-in-new-media/#comments</comments>
		<pubDate>Mon, 29 Dec 2008 15:00:28 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Technology]]></category>
		<category><![CDATA[websites]]></category>
		<category><![CDATA[blog]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[law]]></category>
		<category><![CDATA[lawyer]]></category>
		<category><![CDATA[Seashore]]></category>
		<category><![CDATA[Social Media]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=190</guid>
		<description><![CDATA[<img src="/wp-content/uploads/digitalhhr.jpg" width="75" height="75" class="left" /> DigitalHHR –  I just completed this Wordpress blog for the Intellectual Property department of a major law firm. It features an integrated BBs, an event manager, feature-rich videos, a Flash-powered header,  customized navigation menu and special lawyer profile pages. ]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve just finished a project: <a href="http://digitalhhr.com" target="_blank">DigitalHHR</a> – a WordPress blog for the Intellectual Property department of a big law firm. The IP department, consisting of 4 lawyers, wanted a online platform to promote their ideas and opinions about intellectual property and generate good press for their firm. I was under contract to a wonderful creative agency, <a href="http://www.ahainsight.com/" target="_blank">Aha! Insight Technology</a> and was working again with <a title="Howard Greenstein's Website" href="http://harbroke.com" target="_blank">Howard Greenstein</a>. Howard provided the strategic direction, project management and training for the client while I provided the technology.</p>
<p><a title="digitalhhr" href="http://digitalhhr.com" target="_blank"><img class="alignright" src="http://larryaronson.com/wp-content/uploads/digitalhhr.jpg" alt="Home page of DigitalHHR" width="200" height="189" /></a></p>
<p>Howard proposed a robust set of features to showcase their familiarity with leading edge, social media technologies and services. The specifications called for an integrated BBs, an event manager, feature-rich videos, a Flash-powered header with a customized navigation menu tying it all together. Howard and I knew we were pushing the limits of WordPress and that&#8217;s what the client wanted to show off.</p>
<p>We started with a three column theme, <a title="Seashore Theme page" href="http://topwpthemes.com/seashore/" target="_blank">Seashore</a> by Sadish Bala. I added a video presentation space on top of the  sidebars and a game space below. With a bit of work, I was able to shoehorn the custom flash video the lawyers designed into the header code and replaced the generated navigation menu with a two-level structure.</p>
<p>The four lawyers were already blogging on other sites. This was their first opportunity, not only to write under their own brand, but to actually craft that brand as publishers and editors. As they began to post articles, they became concerned about their authorship rights —they&#8217;re IP lawyers, remember, and important ones at that! So, as we neared completion of the project, new feature requests started creeping in.</p>
<p>They wanted special lawyer profile pages so they could edit in additional content about themselves. These page would feature a portrait image and an expanded contact section with a download-able, virtual address card. For these special pages, I cloned the standard single page template and modified it to fetch the page author&#8217;s portrait photo from a sub directory of /wp-content. I setup custom fields for the contact information and displayed those next to the portrait image. Following that, I formatted a box to display the most recent posts by that author. Finally, I displayed whatever content they wanted to add via the post editor.  <a title="Using custom fields in a wordpress template" href="javascript:void window.open('/wp-content/uploads/lawyer-page_code.gif', 'popit', 'scrollbars=0,height=764,width=772');#utm_source=feed&amp;utm_medium=feed&amp;utm_campaign=feed">Click here to see some of the code</a>.</p>
<p>The head partner of the IP division liked the profile page so much that he wanted a special version just for himself that also displayed  any press articles written about him. I figured out how to accomplish that using a custom post field and some more template programming.</p>
<p>They also wanted to post co-authored articles. I know that there was third-party plug-in that did something like that, but at this late stage of the project, it was easier to add more template modifications to get exactly the functionality the client wanted. The solution we devised features a double portrait image, double email links and a hook to pick up the post for the special lawyer profile pages.</p>
<p>It&#8217;s been exciting to watch this blog progress from it&#8217;s initial launch last month. Everything we did is being used by the client and it&#8217;s all working well.</p>
]]></content:encoded>
			<wfw:commentRss>http://larryaronson.com/2008/lawyers-in-new-media/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

