<?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>Not Just Another WordPress Blog</title>
	<atom:link href="http://wordpress.larryaronson.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wordpress.larryaronson.com</link>
	<description>Larry Aronson</description>
	<lastBuildDate>Thu, 15 Dec 2011 03:04:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>WordPress 3.3 — A Major Update</title>
		<link>http://wordpress.larryaronson.com/wordpress-3-3-a-major-update/</link>
		<comments>http://wordpress.larryaronson.com/wordpress-3-3-a-major-update/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 10:30:45 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[Dashboard]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[jQuery UI]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://wordpress.larryaronson.com/?p=2364</guid>
		<description><![CDATA[WordPress  version 3.3 has arrived and it's a major release. Where version 3.2 was mostly a bug fix and stability release, version 3.3 introduces new tools for all users from admins to authors and subscribers. I've been working with the beta and release candidate versions here on this blog and the improvement that has me most excited is the unified drag-n-drop media loader.]]></description>
			<content:encoded><![CDATA[<p><img class="alignleft size-full wp-image-2375" title="wordpress-3.3-logo" src="http://wordpress.larryaronson.com/wp-content/uploads/wordpress-3.3-logo.png" alt="" width="163" height="184" />The word from WordPress was that version 3.3 would arrive sometime this week. Well, It&#8217;s here and it&#8217;s a major release. Whereas version 3.2 was mostly a bug fix and stability release, version 3.3 introduces new tools for all users from admins to authors and subscribers.</p>
<p>I&#8217;ve been working with the beta and release candidates here on this blog and the improvement that has me most excited is the unified drag-n-drop media loader. In version 3.3, the four buttons for <em>image, video, audio </em>and<em> media </em>are gone;  there&#8217;s only one <em>Upload/Insert media</em> tool.<br />
<br style="clear: both;" /><br />
<img class="aligncenter size-full wp-image-2365" title="one-button-media" src="http://wordpress.larryaronson.com/wp-content/uploads/one-button-media.png" alt="Post editor tool bar with unified media tool" width="551" height="105" /></p>
<p>&nbsp;</p>
<p>Clicking the <em>Upload/Insert</em> button pops up the new loader which defines a space for dragging and droppin one or more files. You can see this in the following screenshot showing me uploading the following screenshot into this post following this sentence.</p>
<p>&nbsp;</p>
<p><a href="http://wordpress.larryaronson.com/wp-content/uploads/drag-n-drop-media-uploader-1.png"><img class="aligncenter size-full wp-image-2367" title="drag-n-drop-media-uploader-1" src="http://wordpress.larryaronson.com/wp-content/uploads/drag-n-drop-media-uploader-1-e1323751897184.png" alt="" width="500" height="306" /></a></p>
<p>&nbsp;</p>
<p>The uploader then smartly figures out what type each file is and displays them in the familiar <em>show/hide</em> popup panel. But, it keeps the drag-n-drop window available for more quick uploads into the gallery. Editors will appreciate this thoughtful touch.</p>
<p>The second new feature I like is the <em>Welcome to WordPress 3.x</em> dashboard page that you&#8217;re returned to after automatically upgrading to a new version. It describes the new features. It&#8217;s the version&#8217;s README file located in your blog at /wp-admin/about.php. It&#8217;s very friendly.</p>
<p><a href="http://wordpress.larryaronson.com/wp-content/uploads/wordpress-about-page.png"><img class="aligncenter size-full wp-image-2370" title="wordpress-about-page" src="http://wordpress.larryaronson.com/wp-content/uploads/wordpress-about-page-e1323791563605.png" alt="" width="540" height="414" /></a></p>
<p>&nbsp;</p>
<p>It part of a package of new features that make the dashboard a more friendly place for the millions of non-technical, website owner/operators who are using WordPress as personal publishing platforms (like many of my clients.) In the same manner, version 3.3 pops up a tip window the first time you try a dashboard feature or visit an admin page.  And, throughout the dashboard, there are improvements and added touches that&#8217;ll make it more application-like. According to the about page, these are:</p>
<ul>
<li><strong>Combined toolbar and admin bar</strong> — They&#8217;ve finally gotten it right and it can be customized by theme developers</li>
<li><strong>Fly-out dashboard menus</strong> — No more accordions. The sub-menu extend out horizontally</li>
<li><strong>Screen design fixes</strong> — To take into account tablets and other non-pc devices and screens</li>
<li><strong>Better  help information</strong> — A frame open at the top of the page with tabbed sections and related links</li>
</ul>
<p>For theme developers, WordPress version 3.3 adds new APIs for the editor and dashboard admin screens supposedly making it easier to customize the back end for special themes and applications. It also include the complete jQuery UI stack and makes good use of it. This more or less standardizes WordPress&#8217; JavaScript framework. It&#8217;s a good move, in my opinion. Other JavaScript frameworks such as MooTools, Prototype and Scriptaculous may have richer behaviors to attach to page elements, but they are also prone to causing plugin conflicts.</p>
<p>Anyway, Based on my first impressions and a few hours spent with it, I con recommend updating your WordPress to version 3.3 soon, especially if you regularly write posts with images and other media attachments. As always, back up your WordPress files and database before you upgrade your website. If you&#8217;re using non-standard plugins or customizations, ask your web developer if they are compatible with the new version. And, don&#8217;t forget that you can aways get answers from the <a href="http://wordpress.org/support/" target="_blank">WordPress Support Forums</a>.</p>
<p>Happy Blogging!<br />
Larry Aronson</p>
<p>&nbsp;</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.larryaronson.com/wordpress-3-3-a-major-update/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>A WordPress Macro Shortcode</title>
		<link>http://wordpress.larryaronson.com/a-wordpress-macro-shortcode/</link>
		<comments>http://wordpress.larryaronson.com/a-wordpress-macro-shortcode/#comments</comments>
		<pubDate>Fri, 17 Jun 2011 04:28:20 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[ShortCodes]]></category>
		<category><![CDATA[google maps]]></category>
		<category><![CDATA[iframe]]></category>
		<category><![CDATA[macro]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[TinyMCE]]></category>

		<guid isPermaLink="false">http://wordpress.larryaronson.com/?p=2197</guid>
		<description><![CDATA[<strong>Good News Everyone!</strong> The post/page editor is getting an upgrade with the soon-to-be-released version 3.2 of WordPress. This solves the problem of disappearing Google maps and YouTube videos, both of which rely on iframe elements to embed the contents of one webpage into another. Because the current version of WordPress' built-in editor doesn't like iframes you have to limit yourself to working in the editor's HTML mode. Once you switch to Visual mode, the iframe elements are stripped out of your post and the map or video disappears. While this limitation is removed in the next release, one of the work-arounds that WordPress developers devised is worth a second look. A general purpose macro shortcode that saves you from ever having to work in the HTML mode again.
]]></description>
			<content:encoded><![CDATA[<h2>Avoiding the Post Editor&#8217;s HTML Mode</h2>
<div class="alignleft"><iframe width="300" height="300" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps?f=q&amp;source=s_q&amp;hl=en&amp;geocode=&amp;q=Madison+Square+Park,+10+Madison+Avenue,+New+York,+NY+10010&amp;aq=0&amp;sll=37.0625,-95.677068&amp;sspn=51.089971,70.136719&amp;ie=UTF8&amp;hq=Madison+Square+Park,+10+Madison+Avenue,+New+York,+NY+10010&amp;ll=40.742445,-73.987513&amp;spn=0.019509,0.025663&amp;z=14&amp;output=embed"></iframe><br /><small><a href="http://maps.google.com/maps?f=q&amp;source=embed&amp;hl=en&amp;geocode=&amp;q=Madison+Square+Park,+10+Madison+Avenue,+New+York,+NY+10010&amp;aq=0&amp;sll=37.0625,-95.677068&amp;sspn=51.089971,70.136719&amp;ie=UTF8&amp;hq=Madison+Square+Park,+10+Madison+Avenue,+New+York,+NY+10010&amp;ll=40.742445,-73.987513&amp;spn=0.019509,0.025663&amp;z=14" style="color:#0000FF;text-align:left">View Larger Map</a></small></div>
<p><strong>Good News Everyone!</strong> The post/page editor is getting an upgrade with the soon-to-be-released version 3.2 of WordPress. This solves the problem of <strong>disappearing Google maps and YouTube videos</strong>. Both rely on <em>iframe</em> elements to embed the contents of one webpage into another. Unfortunately, the current version of WordPress&#8217; built-in editor doesn&#8217;t like iframes* and you have to limit yourself to working in the editor&#8217;s HTML mode. Once you switch to Visual mode, the <em>iframe</em> elements are stripped out of your post or page and the map or video disappears.</p>
<p>In WordPress 3.2RC1 (aka: Release Candidate 1) currently running on this blog, <em>iframe</em> elements are saved as I switch between the editor&#8217;s Visual and HTML modes. So are most of the new HTML5 tags including: the <em>canvas</em> and <em>video</em> elements – but not the <em>audio </em>element! This has been <a href="http://tinymce.moxiecode.com/search.php?searchquery=html5+audio+element" target="_blank">reported as a bug</a>.</p>
<p>In the discussions on blogs and WordPress forums, one of the solutions for working with iframes was to use a general purpose shortcode to work around the editor&#8217;s restrictions. This approach is worth a second look because it gives authors the capability to embed anything they damn well please in a post without ever having to use the editor&#8217;s HTML mode – a big plus for some of my clients who go totally cross-eyed whenever they look at HTML.</p>
<h3>The Macro Shortcode</h3>
<p>Say you want to show a Google map in a post about an event happening in your neighborhood park. Getting the map is easy:</p>
<p><a href="http://wordpress.larryaronson.com/wp-content/uploads/google-map-iframe.png"><img class="alignnone size-full wp-image-2257" style="border-style: initial; border-color: initial;" title="google-map-iframe" src="http://wordpress.larryaronson.com/wp-content/uploads/google-map-iframe.png" alt="Example of using Google Maps embed code" width="600" height="379" /></a></p>
<p>The idea behind the Macro Shortcode is that the embed code from Google (an <em>iframe</em> element) is pasted into a custom field for the post. The name of the custom field can be something descriptive, like &#8220;google-map&#8221;. In the WordPress editor, inside the Custom Fields box, click on the &#8220;Enter New&#8221; link to create a new custom field with the name, &#8220;google-map&#8221;.</p>
<p><a href="http://wordpress.larryaronson.com/wp-content/uploads/custom-field-iframe.png"><img class="alignnone size-full wp-image-2256" style="border-style: initial; border-color: initial;" title="custom-field-iframe" src="http://wordpress.larryaronson.com/wp-content/uploads/custom-field-iframe.png" alt="inserting embed code into a custom field" width="600" height="309" /></a></p>
<div>Now, you can place a shortcode anywhere in the content of a post or page where you want the map to appear:</div>
<p style="padding-left: 30px;"><tt>[macro name="g00gle-map"]</tt></p>
<p>To make this work, you need to define the macro shortcode and add it to your theme. The following PHP code added to your theme&#8217;s <em>functions.php</em> file does the trick.</p>
<code class='markup'></p>
<pre>// macro shortcode — a function to insert the value of a custom field into a post
// [macro page=&lt;page_id&gt; name="post-custom-field-key"]

function my_macro( $atts, $content = null ) {
    extract(shortcode_atts(array( 'page'=&gt;'', 'name'=&gt;'' ), $atts));
    global $post;
    if (!is_numeric($page)) $page = $post-&gt;ID;
    return get_post_meta($page, $name, true);
}</pre>
<pre>add_shortcode('macro', 'my_macro');</pre>
<p></code>
<p>Make sure you first backup the file. See the WordPress Codex for more information on the <em><a href="http://codex.wordpress.org/Function_Reference/get_post_meta" target="_blank">get_post_meta()</a> </em>and <em><a href="http://codex.wordpress.org/Function_Reference/add_shortcode" target="_blank">add_shortcode()</a></em> functions.</p>
<p>The macro shortcode will also accept a post or page id parameter which gets a custom field from some other page or post. This is handy when a small block of marked up content is needed in more than one place on the site. For example, to create a customized <em>signature </em>macro that can be added to the ends of posts (like you do with emails,) you could add a custom field to your <em>bio</em> page. Let&#8217;s say this bio page has an <em>id</em> of  3 and you&#8217;ve created a custom field attached to that page, named it &#8220;signature&#8221; and gave it the following value:</p>
<code class='markup'></p>
<pre>&lt;p style="text-align: right; color: red;"&gt;That's All Folks! 
&amp;mdash;&lt;a href="http://loonytunes.fun/bios/bugs"&gt;&lt;em&gt;B.Bunny&lt;/em&gt;&lt;/a&gt;&lt;/p&gt;</pre>
<p></code>
<p>Now, all you have to do is insert this shortcode at the end of your posts:</p>
<p style="padding-left: 30px;"><tt>[macro page=3 name="signature"]</tt></p>
<p>and it will be replaced with your red, right-aligned sign-off message.</p>
<p>&nbsp;</p>
<div class="post-author">Larry Aronson</div>
<p>&nbsp;</p>
<div class="footnote"><span style="font-size: 10px; font-weight: bold;">* TinyMCE, the WordPress built-in editor, is a JavaScript program that runs in the user&#8217;s browser. It doesn&#8217;t like the  <em>iframe</em> element because it&#8217;s not valid xhtml which the editor is compelled to output when operating in the Visual mode. In the HTML mode, it doesn&#8217;t care; you&#8217;re on your own.</span></div>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.larryaronson.com/a-wordpress-macro-shortcode/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress 3.2 beta 1: First Look</title>
		<link>http://wordpress.larryaronson.com/wordpress-32-beta1-first-look/</link>
		<comments>http://wordpress.larryaronson.com/wordpress-32-beta1-first-look/#comments</comments>
		<pubDate>Tue, 17 May 2011 18:47:21 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Technology]]></category>
		<category><![CDATA[Dashboard]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Twentyeleven]]></category>
		<category><![CDATA[twentyten]]></category>

		<guid isPermaLink="false">http://testlab.larryaronson.com/?p=1894</guid>
		<description><![CDATA[WordPress just released the first beta of the next version of their popular blogging/CMS platform. So, I installed WordPress 3.2, beta 1 on this blog to explore the new features in the Dashboard and took a first look at WordPress' new theme, <strong>Twentyeleven</strong>. This post describes my first impressions.]]></description>
			<content:encoded><![CDATA[<p><a href="http://wordpress.larryaronson.com/wp-content/uploads/twentyeleven-preview1.png"><img class="alignleft size-thumbnail wp-image-1908" title="twentyeleven-preview" src="http://wordpress.larryaronson.com/wp-content/uploads/twentyeleven-preview1-150x150.png" alt="This blog in Twentyeleven theme" width="150" height="150" /></a>I just upgraded this blog to <strong>WordPress version 3.2</strong>, beta 1, which was released to the wild a couple of days ago (<a title="WordPress Announces version 3.2 beta 1." href="http://wordpress.org/news/2011/05/wordpress-3-2-beta-1/" target="_blank">see the announcement</a>.)  Here are my first impressions:</p>
<p>WordPress has introduced a new &#8220;default&#8221; theme, <strong>Twentyeleven</strong>. It&#8217;s a variation of the Twentyten theme introduced with version 3.0, with a slightly cleaner look. I put <em>default</em> in quotes because neither theme is really a default. Both Twentyten and Twentyeleven are better characterized as showcase themes. Both override several of WordPress&#8217; built-in default settings and demonstrate how to use some of the newer features for specific design objectives such as featured images for custom page headers. [<span style="font-size: small;">Note: this blog is using the theme, Tabula Rosa by <a title="Visit author homepage" href="http://leonewball.com/">Leo Newball, Jr.</a> Click the thumbnail above to see what it would look like in Twentyeleven.</span>]</p>
<h4>WordPress Dashboard</h4>
<p>A welcome addition to Twentyeleven is a <strong>Theme Options</strong> dashboard page that provides control over link colors and whether to display the sidebar on the right, left or not at all. The Custom Headers and Background Colors option pages from Twentyten have be duplicated in Twentyeleven.</p>
<p>One new feature all WordPress authors should welcome in the revamped, full-screen editing mode. It&#8217;s has full editing features including a field for the title, a save/update button, tabs to switch from visual to HTML mode and an abbreviated toolbar with icons for bold and italic, ordered and unordered lists, blockquotes, images and links. Strangely, the post editor toolbar has new icons that appear duller and less interesting then before:</p>
<p style="text-align: center;"><a href="http://wordpress.larryaronson.com/wp-content/uploads/wp-post-editor11.png"><img class="aligncenter" title="wp 3.2 post editor" src="http://wordpress.larryaronson.com/wp-content/uploads/wp-post-editor11.png" alt="The post editor for WordPress 3.2" width="518" height="192" /></a></p>
<h4>Post Formats</h4>
<p><a href="http://wordpress.larryaronson.com/wordpress-32-beta1-first-look/wp-post-formats/" rel="attachment wp-att-1937"><img class="size-full wp-image-1937 alignright" title="wp post formats" src="http://wordpress.larryaronson.com/wp-content/uploads/wp-post-formats1.png" alt="Post formats in WordPress" width="165" height="182" /></a>Twentyeleven adds big-time support for <a title="See the description of Post Formats in the WordPress Codex" href="http://codex.wordpress.org/Post_Formats" target="_blank">post formats</a>, which were introduced in version 3.1. Post formats are like categories except that they refer to the content&#8217;s format rather than its subject matter. A post can be in only one format chosen from the predefined list. Where Twentyten moved much of the post processing to template files based on post type: <em>loop.php, loop-page.php, loop-single.php </em>and <em>loop-attachment.php</em>, Twentyeleven has template files specific to post formats: <em>content.php, content-aside.php, content-gallery.php, content-link.php, </em>etc.</p>
<h4>HTML5</h4>
<p>Twentyeleven is an HTML5 theme. So is Twentyten but, whereas Twentyten just has an HTML5 Doctype declaration, Twentyeleven goes further by using the new HTML5 sectioning elements: <em>nav, header, hgroup, article </em>and <em>footer</em>. A conditional statement loads in an HTML5 shim for people using versions of Internet Explorer before IE9. It would be nice to add these new document elements to the paragraph menu on the editor&#8217;s toolbar.</p>
<p>Speaking of IE, the announcement states that WordPress 3.2 will not support IE6 — Yippie! I&#8217;m guessing that this means the Dashboard will not work well in IE6 but, if you make the effort and construct a good CSS stylesheet, the public front end should work. To help, Twentyeleven ids the <em>html</em> element so that you can construct specific CSS rules for IE6 users, such as:</p>
<pre style="padding-left: 30px;">#ie6 div.content { ... }</pre>
<p>The Dashboard&#8217;s been given a facelift. Everything works the same but looks prettier due to new fonts and some CSS3 goodies used to great effect—background gradients, box shadows, rounded corners and text highlights. The little AJAX wrinkles have been smoothed out and the interface elements respond quickly.</p>
<p>I find the small changes made in the Dashboard pleasing and send kudos out to the designers who keep making a good user experience better. One disappointment is that they haven&#8217;t yet addressed the shortcomings in the way WordPress manages media attachments. Instead of having a separate database table, media files are represented by attachment posts in the main post table, reusing post fields for image caption and alternate text information. A rebuilt media manager was supposedly slated for a 2.9.x release but kept getting put back. I look forward to progress in this area.</p>
<p>The upgrade was simple and straightforward, as is usual with WordPress. Since there&#8217;s no automatic install for beta releases, it requires an FTP program to upload the new files. I highly recommend backing up everything first. While not ready for important production websites, this first beta of version 3.2 is worth installing on a test blog just to get an early look at the Twentyeleven theme and begin testing the functionality of post formats.</p>
<p>Overall, editing this post under WordPress 3.2 has been solid. I&#8217;ve not encountered any bugs or glitches. WordPress.org states that 3.2 is a performance upgrade. This is only one post and on a new blog so I can&#8217;t measure or verify any improvement based on my experience so far. I&#8217;ll take their word for it. Thanks WordPress.</p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.larryaronson.com/wordpress-32-beta1-first-look/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Popular Posts Sidebar Page</title>
		<link>http://wordpress.larryaronson.com/sidebar-pages/</link>
		<comments>http://wordpress.larryaronson.com/sidebar-pages/#comments</comments>
		<pubDate>Tue, 10 May 2011 17:36:33 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[Functions]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[popular posts]]></category>
		<category><![CDATA[shortcode]]></category>
		<category><![CDATA[sidebar widget]]></category>

		<guid isPermaLink="false">http://testlab.larryaronson.com/?p=24</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. Often, the best approach is to just throw a page with a list of permalinks into your sidebar. Here's how to create a sidebar widget that will display a page featuring the posts you want to highlight.]]></description>
			<content:encoded><![CDATA[<h2>Crafting a Custom &#8220;Popular Posts&#8221; Widget</h2>
<p><a href="http://wordpress.larryaronson.com/sidebar-pages/top-ten-blocks/" rel="attachment wp-att-1882"><img class="alignleft size-medium wp-image-1882" title="top ten blocks" src="http://wordpress.larryaronson.com/wp-content/uploads/top-ten-blocks1-300x243.jpg" alt="top ten blocks" width="300" height="243" /></a>A client wanted to list the blog&#8217;s <strong>most popular posts</strong> in the sidebar. 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 her 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 management of a Top-Ten Posts lists.</p>
<p>Rather than write a new sidebar widget, I decided to write a <strong>shortcode</strong> which could be used in a sidebar text widget to display the content from a specific page. Then my client could simply edit a page containing an ordered list of permalinks to the most popular posts and it would appear in the sidebar widget. It could also be used in other posts or pages on the site.</p>
<h3>How to Build a Sidebar Page Widget</h3>
<p>To start, create a new static page with a title like, &#8220;Popular Posts&#8221;. Enter an ordered list of permalinks to other posts for testing.</p>
<p>You need to add a function to your theme&#8217;s <strong>function file</strong>, <em>functions.php</em>, that will output the contents of a page when called from the shortcode. Make sure you backup <em>functions.php</em> before you make any changes! WordPress has built-in functions for getting the contents of a page<em></em>. Use <em>get_page_by_title( )</em> to fetch the page by its title. Here&#8217;s the code for the function:<br />
<code>function my_show_page( $atts, $content = null ) {<br />
  extract(shortcode_atts(array( 'title'=&gt;'' ), $atts));<br />
  if ($title != '') {<br />
    $page_data = get_page_by_title( $title );<br />
    return $page_data-&gt;post_content;<br />
  }<br />
  else {<br />
    return '';<br />
  }<br />
}<br />
</code><br />
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 there is only one parameter, the page&#8217;s title which is extracted by the second line of the code. Setting the variable <em>$content</em> to null allows us to place the simple shortcode:</p>
<p><code>[showpage title="Popular Posts"]</code></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. 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 shortcode must be registered to make it available for use. This is just a short command that also goes in the theme&#8217;s function file:</p>
<p><code>add_shortcode('showpage', 'my_show_page');</code></p>
<p>It can go either before or after the definition of the <em>my_show_page</em> 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>Shortcodes are not enabled by default in text widgets because of security concerns. Sidebar text widgets are places where people often embed code clipped from outside sources. The concern is that such embedded code might contain a shortcode that could cause a conflict. This is usually not a problem for smaller, personal blogs. Here&#8217;s the command to enable shortcodes in text widgets:</p>
<p><code>add_filter('widget_text', 'do_shortcode');</code></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 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:<br />
<code>/**<br />
* Create a shortcode to display a page's content */<br />
//<br />
// [showpage title="page_title"]<br />
//<br />
function my_show_page( $atts, $content = null ) {<br />
  extract(shortcode_atts(array( 'title'=&gt;'' ), $atts));<br />
  if ($title != '') {<br />
    $page_data = get_page_by_title( $title );<br />
    return $page_data-&gt;post_content;<br />
  }<br />
  else {<br />
    return '';<br />
  }<br />
}<br />
// register the shortcode<br />
add_shortcode('showpage', 'my_show_page');<br />
//<br />
// Enable the use of shortcodes in text widgets.<br />
add_filter('widget_text', 'do_shortcode');<br />
</code><br />
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://wordpress.larryaronson.com/sidebar-pages/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Free Images For Your Posts</title>
		<link>http://wordpress.larryaronson.com/get-free-images-for-your-posts/</link>
		<comments>http://wordpress.larryaronson.com/get-free-images-for-your-posts/#comments</comments>
		<pubDate>Tue, 03 May 2011 21:54:22 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[FAQ]]></category>
		<category><![CDATA[Blogging]]></category>
		<category><![CDATA[copyright]]></category>
		<category><![CDATA[Creative Commons]]></category>
		<category><![CDATA[Flickr]]></category>
		<category><![CDATA[Free images]]></category>
		<category><![CDATA[Google Images]]></category>
		<category><![CDATA[Library of Congress]]></category>
		<category><![CDATA[photos]]></category>

		<guid isPermaLink="false">http://wordpress.larryaronson.com/?p=2052</guid>
		<description><![CDATA[Every post needs a good picture. A photograph or illustration provides a visual anchor for the post and helps set the mood that you want your reader to be in when he or she reads the copy. But where can you consistently find good images on the Internet that are free to use without violating someone's copyright. The answer to this frequently asked question is: tons of places &#8211; you just need to know where to search. Here a quick guide to finding copyright and permission free images to use in your blog posts.]]></description>
			<content:encoded><![CDATA[<h3 class="question">Where can I get free images to spice up my blog posts, without violating someone&#8217;s copyright?</h3>
<div class="answer">
<p>Get copyright free images from archives that curate pubic domain photographs and illustrations.</p>
<p>Start with the <a title="Catalog of public domain images" href="http://www.usa.gov/Topics/Graphics.shtml" target="_blank">U.S. Government Photos and Images library</a>, a categorized index with good searching capabilities. Also, checkout the <a title="Library of Congress images" href="http://www.loc.gov/pictures/" target="_blank">Library of Congress Prints &amp; Photographs Online Catalog</a>. <a href="http://en.wikipedia.org/wiki/Wikipedia:List_of_online_image_archives" target="_blank">Wikipedia&#8217;s Free Images Resource Index</a>  has an extensive list of Websites to browse.</p>
<p style="text-align: center;"><a href="http://www.usa.gov/Topics/Graphics.shtml" target="_blank"><img class="size-full wp-image-2064" title="usa gov logo" src="http://wordpress.larryaronson.com/wp-content/uploads/usagov_logo.gif" alt="United States of America" width="202" height="62" /></a>     <a href="http://www.loc.gov/pictures/" target="_blank"><img class="size-full wp-image-2063 alignnone" title="Library-of-congress" src="http://wordpress.larryaronson.com/wp-content/uploads/Library-of-congress.png" alt="" width="194" height="62" /></a></p>
<p>Unless an image is known to be in the public domain, you should assume that it is copyrighted content and that you need to get permission before you can republish it on your blog. That holds true even if there&#8217;s no one identified as the owner. The protections of copyright law are not waved by the omission of a copyright notice. A copyright holder can give permission in advance either by saying so explicitly or by using a public license such as those provided by <a href="http://creativecommons.org/licenses" target="_blank">Creative Commons</a> organization.</p>
<p>Creative Commons licenses usually require that you provide a photo credit or similar attribution with your use of an image or illustration. Copyright holders can add additional terms and conditions for permission-free use if they want. Some licenses will allow you to modify or adapt an image if you agree to share and share alike with regard to your work.</p>
<h4>How to search <a href="http://Flickr.com/" target="_blank">Flickr.com</a> and <a href="http://images.google.com" target="_blank">Google</a> for Creative Commons licensed images</h4>
<p>On <strong>Flickr</strong>, after searching on a keyword, click on the link for Advanced Search. Select the options for Searching within Creative Commons licensed content, then click the search button below that:</p>
<h3><img class="alignnone size-full wp-image-2056" title="Flickr  Advanced Search" src="../wp-content/uploads/Flickr_-Advanced-Search-2.png" alt="" width="612" height="202" /></h3>
<p>Generally, you don&#8217;t need permission to &#8220;modify, adapt or build upon&#8221; if all you do is resize and/or crop an image without changing its meaning.</p>
<p>On <strong>Google Images</strong>, click on the advanced search link. Fill in your search criteria and choose an appropriate option from the drop menu next to &#8220;Usage Rights&#8221;:</p>
<p><img class="alignnone size-full wp-image-2055" title="Google Advanced Image Search" src="http://wordpress.larryaronson.com/wp-content/uploads/Google-Advanced%C2%A0Image%C2%A0Search.png" alt="" width="666" height="538" /></p>
<p>You want to download the image file to your local computer and then upload it to your media library to insert into a post or page. While you can always link to an image file as an alternative to uploading your own copy, I recommend taking a copy so that the physical file in under your control. Do not try to copy the image  from a browser window and then paste it into the WordPress editor. That rarely works. Since the download procedure on every photo/image site will be different,  make sure that you are getting either a GIF, JPEG or PNG format file (file extensions: .gif, .jpg, .jpeg, .png).</p>
<p><a href="http://wordpress.larryaronson.com/get-free-images-for-your-posts/aitutaki/" rel="attachment wp-att-2092"><img class="size-thumbnail wp-image-2092 alignright" title="Aitutaki" src="http://wordpress.larryaronson.com/wp-content/uploads/Aitutaki-150x150.jpg" alt="Aitutaki Lagoon – &amp;copy; 2008 Larry Aronson" width="150" height="150" /></a>Of course, the surest way to get a free image is to take/make it yourself. This thumbnail, used as the featured image for this post, was taken by me on my honeymoon in Aitutaki. It doesn&#8217;t have anything to do with this article but I&#8217;m using it just because I love it. If you&#8217;d like to use it in your publication—<em>ASK ME</em>.</p>
<pre>
</pre>
</div>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.larryaronson.com/get-free-images-for-your-posts/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Custom Widget Titles With jQuery</title>
		<link>http://wordpress.larryaronson.com/jquery-custom-widget-titles/</link>
		<comments>http://wordpress.larryaronson.com/jquery-custom-widget-titles/#comments</comments>
		<pubDate>Fri, 22 Apr 2011 13:24:49 +0000</pubDate>
		<dc:creator>Larry Aronson</dc:creator>
				<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[jQuery addClass]]></category>
		<category><![CDATA[sidebar widget]]></category>
		<category><![CDATA[Twitter]]></category>
		<category><![CDATA[twitter tools]]></category>

		<guid isPermaLink="false">http://larryaronson.com/?p=1076</guid>
		<description><![CDATA[A technique for adding custom styles and links to individual sidebar widget titles using jQuery methods to select elements by their content.]]></description>
			<content:encoded><![CDATA[<p>A lot of the <strong>WordPress</strong> customization I do happens inside of sidebar text widgets. You can put any HTML inside a text widget including in-line JavaScript and CSS styles. Unfortunately, that doesn&#8217;t apply to widget titles. WordPress strips all markup from widget titles. Also, not all themes add a unique id attribute for each separate widget. Here&#8217;s how I added custom styling to a sidebar widget title using jQuery&#8217;s ability to select individual HTML document elements based on their content.</p>
<p>Most everything described in this post can be done using only WordPress&#8217; built-in template editor available to admin level users.</p>
<p>One client wanted to display a Twitter stream in a sidebar widget showing all tweets mentioning his company. His designer provided this nice graphic to use as the background to the widget&#8217;s title:</p>
<p><img class="aligncenter size-full wp-image-1077" title="Twitter_widget_background" src="http://larryaronson.com/wp-content/uploads/Twitter_widget_background.png" alt=" Twitter feed widget title background image" width="361" height="36" /></p>
<p>with the text to appear in white, shifted over enough to give the bird some room to fly. In the Widgets manager (under the <em>Appearance</em> menu,) I added a new text widget to the the sidebar and gave it the title: &#8220;Our Company on Twitter.&#8221; I left the body of the text widget empty for now and saved it.</p>
<p>I reloaded the site&#8217;s front page and inspected the source code to see how this particular theme marked up the title with HTML. It was in a level three heading (h3,) enclosed inside of a division with <strong><tt>id="sidebar"</tt></strong>. With no unique identifier for the widget, I couldn&#8217;t simply code a CSS rule, such as:</p>
<pre><code class='markup'>#sidebar h3 {
  color: white;
  background: url(images/twitter_widget_background.png) no-repeat;
}</code></pre>
<p>as that would put the twitter background behind all sidebar titles and headings.</p>
<p>jQuery to the rescue. It has a method for adding a CSS class to an HTML element and can select document elements by searching their content. jQuery is not loaded by default in WordPress but many themes load it automatically at initialization. See the <a href="http://codex.wordpress.org/Function_Reference/wp_enqueue_script" target="_blank">WordPress Codex page on enqueing scripts</a> for information on safely loading jQuery from various sources.</p>
<p>Using an FTP program, I uploaded the image to the <em>images </em>directory inside of the theme directory. If you don&#8217;t have FTP, you can use the file manager in your hosting account&#8217;s control panel. Alternatively, you can upload a graphic to your Media Library using WordPress&#8217;s media manager and then use the full URL in the CSS below.  The CSS class is needed to establish the background element. It goes in the stylesheet template (<em>style.css </em>) which can be edited using the Appearance Editor.</p>
<pre><code class='markup'>#sidebar h3.twitter {
  color: white;
  background: url(images/Twitter_widget_background.png) no-repeat;
  height: 36px;
  padding-left: 60px;
 }</code></pre>
<p>Some simple jQuery is added to the header template (<em>header.php</em>.) It can go anywhere after the script tag for the jQuery library.</p>
<pre><code class='markup'>&lt;script type="text/javascript"&gt;
   jQuery(document).ready(function() {
     jQuery("#sidebar h3:contains('Our Company on Twitter')").addClass('twitter');
   });
&lt;/script&gt;</code></pre>
<p>When the document is ready and all elements have been defined, the above code will attach the CSS class, <em>twitter,</em> to any level three heading in the sidebar that contains the string: &#8220;Our Company on Twitter&#8221;.</p>
<p>The Twitter search feed comes directly from <a href="http://twitter.com/goodies/" target="_blank">Twitter&#8217;s goodies page</a>. One of the goodies is an interactive <a href="http://twitter.com/goodies/widget_search" target="_blank">wizard</a> that will generate the code to copy-paste into the sidebar text widget&#8217;s content.</p>
<p style="text-align: center;"><a href="http://wordpress.larryaronson.com/jquery-custom-widget-titles/twitter-search-widget/" rel="attachment wp-att-1955"><img class="aligncenter size-full wp-image-1955" title="Twitter Search Widget" src="http://wordpress.larryaronson.com/wp-content/uploads/Twitter-Search-Widget1.png" alt="Constructing a search widget on Twitter.com" width="600" height="444" /></a></p>
<p>You can do more than just change how the title looks. Want to make a widget title link to something? In the same way that a CSS class can be given an element based on its content, the element&#8217;s behavior can be changed. Working with the code above, a click handler can be added to the selected widget title.</p>
<pre><code class='markup'>&lt;script type="text/javascript"&gt;
  jQuery(document).ready(function() {
    twitterWidget = jQuery("#sidebar h3:contains('Our Company on Twitter')");
    twitterWidget.addClass('twitter');
    twitterWidget.click( function () {
      document.location = 'http://twitter.com/OurCompany';
    });
  });
&lt;/script&gt;</code></pre>
<p>Adding the following CSS style rules to the theme&#8217;s stylesheet will make the title look and act more like a link:</p>
<pre><code class='markup'>#sidebar h3.twitter:hover {
  color: blue;
  text-decoration: underline;
  cursor: pointer;
}</code></pre>
<div class="post-author">Larry Aronson</div>
<h4>Resources:</h4>
<ul>
<li><a href="http://docs.jquery.com/" target="_blank">jQuery documentation</a></li>
<li><a href="http://www.w3schools.com/css/css_background.asp" target="_blank">CSS background images</a></li>
</ul>
<p><sup><a name="footnote1"></a></sup></p>
]]></content:encoded>
			<wfw:commentRss>http://wordpress.larryaronson.com/jquery-custom-widget-titles/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

