<?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>Jefferson&#039;s Newspaper &#187; omeka</title>
	<atom:link href="http://jeffersonsnewspaper.org/tags/omeka/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeffersonsnewspaper.org</link>
	<description>A blog about information, education, and the (digital) humanities...</description>
	<lastBuildDate>Wed, 25 Aug 2010 13:59:47 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Adding a Featured Image Gallery to Omeka Using GalleryView</title>
		<link>http://jeffersonsnewspaper.org/2010/adding-a-featured-image-gallery-to-omeka-using-galleryview/</link>
		<comments>http://jeffersonsnewspaper.org/2010/adding-a-featured-image-gallery-to-omeka-using-galleryview/#comments</comments>
		<pubDate>Thu, 15 Jul 2010 03:39:39 +0000</pubDate>
		<dc:creator>E. Bell</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[galleryview]]></category>
		<category><![CDATA[homepage]]></category>
		<category><![CDATA[image galleries]]></category>
		<category><![CDATA[omeka]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://jeffersonsnewspaper.org/?p=814</guid>
		<description><![CDATA[Following on my previous entry on adding an image Lightbox to Omeka, today I&#8217;ll run through the steps it takes to get a featured image gallery running on your Omeka homepage. I searched for awhile to find a gallery plugin that a.) looks good, b.) works well and c.) is not too complicated for me [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://jeffersonsnewspaper.org/wp-content/uploads/2010/07/screen-capture-1.png" alt="" title="GalleryView Demo Image (via SpaceForAName)" width="817" height="430" class="aligncenter size-full wp-image-849" /></p>
<p>Following on my previous entry on <a title="Adding an Image Lightbox to Omeka" href="http://jeffersonsnewspaper.org/2009/adding-an-image-lightbox-in-omeka/">adding an image Lightbox to Omeka</a>, today I&#8217;ll run through the steps it takes to get a featured image gallery running on your Omeka homepage. I searched for awhile to find a gallery plugin that a.) looks good, b.) works well and c.) is not too complicated for me to figure out.  Fitting the bill nicely, I found <a title="GalleryView @ SpaceForAName" href="http://spaceforaname.com/galleryview">GalleryView</a>, a fairly lightweight jQuery plugin with lots of options for your tweaking enjoyment.  It&#8217;s a bit more challenging to implement than Lightbox and requires a fair amount of CSS knowledge to prettify, but this should help you get started.</p>
<p><span id="more-814"></span></p>
<p><strong>Step One: Download and Install GalleryView (and edit the GalleryView CSS)</strong></p>
<p><a title="GalleryView @ SpaceForAName" href="http://spaceforaname.com/galleryview">Download the GalleryView package</a> and place it in your theme&#8217;s /common/ directory.  Be sure that you have placed the whole shebang directly inside the /common/ directory and renamed the outer folder galleryview (if you use the default galleryview-2.1.1 name, you&#8217;ll need to adjust the scripts below to match).  Go into your theme to common/galleryview/galleryview.css and edit the first id, changing it from #photos to #featured-gallery (or something else if you prefer, see below for details).</p>
<p><strong>Step Two: Edit your Header (Scripts and Configurations)</strong></p>
<p>The code below will work as is if you are using the popular Berlin theme, but if not simply replace the word berlin below with the name of your Omeka theme.  Be sure the paths below match with where you actually placed your files in the previous step. </p>
<p><em>*** To save hours of confusion, watch out for typos and try using your browser&#8217;s &#8220;view source&#8221; feature to ensure that your links are reaching their destination.</em></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;link rel=&quot;stylesheet&quot; href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/berlin/common/galleryview/galleryview.css&quot; type=&quot;text/css&quot; media=&quot;screen&quot; /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;http://code.jquery.com/jquery-1.4.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/berlin/common/galleryview/jquery.galleryview-2.1.1-pack.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/berlin/common/galleryview/jquery.timers-1.2.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/berlin/common/galleryview/jquery.easing.1.3.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
		jQuery.noConflict();  
		jQuery(document).ready(function(){
		jQuery('#featured-gallery').galleryView({
			panel_width: 425,
			panel_height:430,
			filmstrip_position:'bottom',
			show_captions: true,
			pause_on_hover:true,
			transition_interval:5000,
			nav_theme:'light'
		});
	});
&lt;/script&gt;</pre></div></div>

<p>That final, multi-line script above initializes GalleryView and contains your configurations.  You can change them however you like according to the <a href="http://spaceforaname.com/galleryview">GalleryView documentation</a>, but here I&#8217;m setting the dimensions, timing, theme, etc.  There are a couple other things worth highlighting here if you are not familiar with JavaScript.  First of all, the string containing #featured-gallery is setting up the gallery to run automatically on images displayed in the html div with the id of &#8220;featured-gallery&#8221; &#8211; you can change this to whatever you like, but remember that it needs to match the outer div on your index page in the next step. Also worth noting, the script generally runs on a generic placeholder function called $, but in order to get around the conflict with the Prototype library (which also uses $ as a generic placeholder), I&#8217;ve included the jQuery.noConflict() line and replaced $ with jQuery.</p>
<p><strong>Step Three: Edit your Index Page (Looping Items and Calling GalleryView)</strong></p>
<p>The code below uses a custom loop to retrieve the images.  As noted, the outer div uses the id &#8220;featured-gallery&#8221;, as well as a required class, &#8220;galleryview&#8221; &#8212; #featured-gallery <em>is the only</em> id or class that you can change below!</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>Featured Items<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;featured-gallery&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;galleryview&quot;</span><span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;</span>ul id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;gallery&quot;</span><span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span> ?php 
		<span style="color: #666666; font-style: italic;">//this loops the 5 most recent featured items</span>
		<span style="color: #000088;">$items</span> <span style="color: #339933;">=</span> get_items<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'featured'</span><span style="color: #339933;">=&gt;</span>true<span style="color: #339933;">,</span> <span style="color: #0000ff;">'recent'</span><span style="color: #339933;">=&gt;</span>true<span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		set_items_for_loop<span style="color: #009900;">&#40;</span><span style="color: #000088;">$items</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span>loop_items<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;</span> ?php <span style="color: #000088;">$index</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span> <span style="color: #339933;">=</span> loop_files_for_item<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			    <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$file</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">hasThumbnail</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			    <span style="color: #339933;">&lt;!--</span> this makes sure the loop grabs only the first image <span style="color: #b1b100;">for</span> the item <span style="color: #339933;">--&gt;</span>
			        <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$index</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		    	       <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">echo</span> <span style="color: #666666; font-style: italic;">/*Image URL*/</span><span style="color: #0000ff;">'&lt;li&gt;&lt;img src=&quot;'</span><span style="color: #339933;">.</span>item_file<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'square thumbnail uri'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot;/&gt;'</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
		    	    <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			    <span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;</span> ?php
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;div class=&quot;panel-overlay&quot;&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #666666; font-style: italic;">/*Item Title*/</span><span style="color: #0000ff;">'&lt;h3&gt;'</span><span style="color: #339933;">.</span>item<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Dublin Core'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Title'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/h3&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #666666; font-style: italic;">/*Item Description Excerpt*/</span><span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">.</span>item<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Dublin Core'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'Description'</span><span style="color: #339933;">,</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'snippet'</span><span style="color: #339933;">=&gt;</span><span style="color: #cc66cc;">175</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #666666; font-style: italic;">/*Link to Item*/</span> link_to_item<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' ...more '</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&lt;/p&gt;&lt;/ul&gt;&lt;/div&gt;'</span><span style="color: #339933;">;</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>
			<span style="color: #339933;">&lt;</span> ?php <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>I&#8217;ve added some comments inline with the code above to describe what it&#8217;s doing, so if they make sense to you, you can probably figure out any changes you might need (for example, looping more or fewer images meeting whatever Omeka-friendly criteria you like).  </p>
<p><em>*** I&#8217;m using square thumbnails in my loop because they&#8217;re easy, but you may need to adjust the max thumbnail size in your Omeka settings to avoid blurry images.</em></p>
<p><strong>Step Four: Season to Taste</strong></p>
<p>Though the example above works pretty nicely &#8220;out of the box&#8221; in a two column homepage theme, the <a href="http://spaceforaname.com/galleryview">GalleryView documentation</a> contains a list of configuration options, so you will probably want to fool around with those, as well as your CSS, to integrate GalleryView properly into your theme&#8217;s overall aesthetic.  You might also want to <a href="http://omeka.org/codex/Create_a_Custom_Loop_of_Items">customize the loop in Omeka</a> (personally, I&#8217;m not a huge fan of the one used above, but haven&#8217;t figured out a better one just yet).</p>
<p>Hope this has helped a few folks out there who, like me, are working near the edges of their skill set.  As always, feel free to share your comments, questions, suggestions, critiques, etc.  I&#8217;ll try to keep this updated as needed.</p>
<p>By the way, I&#8217;m planning to release a new Omeka theme that incorporates both Lightbox and GalleryView, as well as some other fun stuff, so stay tuned.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffersonsnewspaper.org/2010/adding-a-featured-image-gallery-to-omeka-using-galleryview/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Adding an Image Lightbox in Omeka</title>
		<link>http://jeffersonsnewspaper.org/2009/adding-an-image-lightbox-in-omeka/</link>
		<comments>http://jeffersonsnewspaper.org/2009/adding-an-image-lightbox-in-omeka/#comments</comments>
		<pubDate>Thu, 19 Nov 2009 15:03:21 +0000</pubDate>
		<dc:creator>E. Bell</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[LightBox]]></category>
		<category><![CDATA[omeka]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://jeffersonsnewspaper.org/?p=591</guid>
		<description><![CDATA[Maybe it&#8217;s just me, but I had a heckuva time trying to figure out how to implement Lightbox 2 in Omeka. After piecing together info and code from here and there, then adding my own little improvements, I&#8217;ve constructed a simple little 4-step guide to document the process and, hopefully, help make this process a [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://jeffersonsnewspaper.org/wp-content/uploads/2009/11/Untitled-11.jpg" alt="LightBox-example_OCW150" title="LightBox-example_OCW150" width="630" height="auto" class="aligncenter size-full wp-image-609" />Maybe it&#8217;s just me, but I had a heckuva time trying to figure out how to implement <a title="LightBox2 by Lokesh Dhakar" href="http://www.huddletogether.com/projects/lightbox2/">Lightbox 2</a> in <a title="Omeka" href="http://omeka.org/">Omeka</a>.  After piecing together info and code from here and there, then adding my own little improvements, I&#8217;ve constructed a simple little 4-step guide to document the process and, hopefully, help make this process a little less vexing for others out there who aren&#8217;t PHP and Java Script pros.</p>
<p><span id="more-591"></span></p>
<p><strong>Step One: Get the Lightbox Package</strong></p>
<p>The first step is to get the latest LightBox 2 package <a title="LightBox2 by Lokesh Dhakar" href="http://www.huddletogether.com/projects/lightbox2/">here</a>, where you will find a quick explanation of how it works and how to get started.</p>
<p><strong>Step Two: Modify and Upload the LightBox Package</strong></p>
<p>Once you have the package, make sure it&#8217;s in a folder called &#8220;lightbox&#8221; and upload it to your Omeka theme directory inside the &#8220;common&#8221; directory where your header and footer files are located.  Take the image files and copy them to your theme&#8217;s &#8220;images&#8221; directory.</p>
<p>Inside common/lightbox/js directory, find the file called &#8220;lightbox.js&#8221; and set your configurations.  This is where you set your lightbox behaviors (overlayOpacity, animate, resizeSpeed, borderSize, etc.) and also where you tell LightBox how to find the images and labels to display Close and Loading.  When setting the former, you can fiddle with the defaults to get the style you need, it&#8217;s pretty easy to understand.  For the latter (image locations), you can use either a relative or a direct URL.  If a relative location (e.g. &#8216;../images/loading.gif&#8217;) does not work for you, try using the direct URL (e.g. &#8216;http://www.yoursite.com/omeka/themes/themename/images/loading.gif&#8217;).  My impression is that Omeka requires the direct URL for some reason.  You could probably leave the images in the &#8220;lightbox&#8221; directory and point to them there as well.</p>
<p><strong>Step Three: Modify your Omeka Theme Header</strong></p>
<p>Add the script to your theme header (be sure to modify with your actual theme name):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!-- Start Lightbox includes --&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/themename/common/lightbox/js/prototype.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/themename/common/lightbox/js/scriptaculous.js?load=effects,builder&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> WEB_ROOT<span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>/themes/themename/common/lightbox/js/lightbox.js&quot;&gt;&lt;/script&gt;
&lt;!-- End Lightbox includes --&gt;</pre></div></div>

<p>Pretty basic.</p>
<p>Also, you&#8217;ll want to either copy the LightBox CSS styles into your theme&#8217;s stylesheet or move it to the theme styles directory and link to it in your header.  Either way, be sure to double check that your images are properly linked.  I find that having the LightBox styles included in a single stylesheet is preferable, but if you want, you can use something like this after moving lightbox.css to your theme directory:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>link rel<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;stylesheet&quot;</span> href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;css/lightbox.css&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text/css&quot;</span> media<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;screen&quot;</span> <span style="color: #339933;">/&gt;</span></pre></div></div>

<p><strong>Step Four: Modify Your Omeka Items-Show Page</strong></p>
<p>This is where I got hung up.  The site I was working on has multiple file types &#8212; not just images, but also audio and video.  I was lucky enough to find a starting point on the <a title="Lightbox | Omeka Dev Google Group" href="http://groups.google.com/group/omeka-dev/browse_thread/thread/db7e65096a08b26f">Omeka Dev Google Group</a> as well as on the <a title="Lightbox | Omeka Forums" href="http://omeka.org/forums/topic/what-handle-to-access-mediaphp-for-a-new-plugin">Omeka Forums</a>, but the code was written for item pages with a single image file.  Since I&#8217;m not great with arrays, it took me a while to come up with the imperfect code below.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">	<span style="color: #339933;">&lt;!--</span> The following returns all of the files associated with an item<span style="color: #339933;">.</span> <span style="color: #339933;">--&gt;</span>
	<span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;itemfiles&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;element&quot;</span><span style="color: #339933;">&gt;</span>
	    <span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;</span>Files<span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span>
		<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;element-text&quot;</span><span style="color: #339933;">&gt;</span>
		    <span style="color: #339933;">&lt;</span> ?php 
		    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>item_has_thumbnail<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> 
					<span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;&lt;em&gt;Click the Image for Full Size&lt;/em&gt;'</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> display_files_for_item<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'linkAttributes'</span><span style="color: #339933;">=&gt;</span>array<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rel'</span><span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'lightbox[group]'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
										<span style="color: #009900;">&#125;</span>
			<span style="color: #b1b100;">else</span>
				<span style="color: #009900;">&#123;</span>
				<span style="color: #b1b100;">echo</span> display_files_for_item<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
&nbsp;
	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div>

<p>This script will test if the item has a thumbnail (i.e. &#8220;is it an image?&#8221;).  If it does, it will display the files as square thumbnails and give them &#8216;rel=&#8221;lightbox[group]&#8220;&#8216; &#8211; clicking on images with the &#8220;lightbox&#8221; relation in the URL will prompt the light box; if there are two or more images associated with the file, the &#8216;[group]&#8216; part will kick in to add the Next and Previous buttons.  If the item file is not an image, the script calls the generic Omeka function display_files_for_item(), which will automatically call the media player (for audio and video) if needed.</p>
<p>A pretty easy process when you have it all right in front of you.  Hope this will be helpful to someone out there.</p>
<p>NOTE: I&#8217;ll continue to update this post with any improvements.  If <em>you</em> have a problem, fix, or improvement to share, please add it in the comments or catch me on Twitter (<a href="http://twitter.com/ebellempire">@ebellempire</a>).  I&#8217;ve also cross-posted this tutorial in the documentation wiki at <a href="http://omeka.org/codex/Adding_LightBox_to_Omeka">Omeka.org</a>, so feel free to contribute there as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffersonsnewspaper.org/2009/adding-an-image-lightbox-in-omeka/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Building a WordPress Static Homepage with Dynamic Elements</title>
		<link>http://jeffersonsnewspaper.org/2009/building-a-wordpress-static-homepage-with-dynamic-elements/</link>
		<comments>http://jeffersonsnewspaper.org/2009/building-a-wordpress-static-homepage-with-dynamic-elements/#comments</comments>
		<pubDate>Tue, 22 Sep 2009 18:07:30 +0000</pubDate>
		<dc:creator>E. Bell</dc:creator>
				<category><![CDATA[Reference]]></category>
		<category><![CDATA[category feeds]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dummyproofing]]></category>
		<category><![CDATA[excerpt]]></category>
		<category><![CDATA[external feeds]]></category>
		<category><![CDATA[feeds]]></category>
		<category><![CDATA[omeka]]></category>
		<category><![CDATA[rss]]></category>
		<category><![CDATA[static homepages]]></category>
		<category><![CDATA[theme functions]]></category>
		<category><![CDATA[themes]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://jeffersonsnewspaper.org/?p=421</guid>
		<description><![CDATA[One of the nice features of WordPress is the ability to create static homepages. While most blogs use the standard configuration, where users scroll vertically from the most recent to older blog posts, it often makes sense to use a static homepage instead &#8212; especially if you are looking to create a more professional looking [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://jeffersonsnewspaper.org/wp-content/uploads/2009/09/Manhattan_Bridge_Construction_19091.jpg" width="620px" height="auto"/>One of the nice features of WordPress is the ability to create <a title="Static Homepages @ WP" href="http://codex.wordpress.org/Creating_a_Static_Front_Page">static homepages</a>.  While most blogs use the standard configuration, where users scroll vertically from the most recent to older blog posts, it often makes sense to use a static homepage instead &#8212; especially if you are looking to create a more professional looking site, or are using <a title="WP as CMS @ DevLounge.net" href="http://www.devlounge.net/publishing/things-to-consider-when-using-wordpress-as-a-cms">WordPress as a Content Management System</a>.  I recently tackled a project where we needed to create a static homepage with the following features</p>
<ol>
<li>The homepage needed to look &#8220;homepagey&#8221; (i.e. not &#8220;bloggy&#8221;)</li>
<li>Client needed room for a short introductory text, which could be edited/updated on the fly without disrupting the homepage layout</li>
<li>The homepage needed to highlight the many features on the site, so that users could quickly scan the page, see what the site had to offer, and quickly find the latest update in each area.</li>
</ol>
<p>This quick tutorial will share some code for reproducing something that meets all or some of those criteria.  You don&#8217;t need to know much code to complete this tutorial, but a little helps.  Once you create and implement your homepage template, you will need to use CSS to add styles and adjust the layout.</p>
<p><span id="more-421"></span></p>
<p><strong>The Basics of Creating a Homepage Template</strong></p>
<p>This is pretty well-documented elsewhere, but here&#8217;s what you need to know on the most basic level.  If you are using a prefab theme, find that theme&#8217;s page.php file.  Now take that file and make a copy called homepage.php (or really, whatever you like).  Next, add the five lines below to the very top of the page (before the header and sidebar calls):</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">/*
Template Name: Home Page
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Now, when you edit or create the page you want to use as Home, you can choose the Home Page template and set it as the static homepage for your site in Settings >> Reading.  But this won&#8217;t get you far.  As is, this template just replicates the behavior of any page on your site.  That&#8217;s not very exciting.  Instead, let&#8217;s try adding some dynamic content to the template.</p>
<p><strong>Note on custom theme_excerpt() function used below</strong></p>
<p>Before you get all crazy and just copy-paste from the homepage code below, note that I am using a custom function to generate post excerpts. To use that function you must first create a file called functions.php and add the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #000000; font-weight: bold;">function</span> theme_excerpt<span style="color: #009900;">&#40;</span><span style="color: #000088;">$num</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$more</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$limit</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$num</span><span style="color: #339933;">+</span><span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">,</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span>get_the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">array_pop</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot; &quot;</span><span style="color: #339933;">,</span><span style="color: #000088;">$excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excerpt</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'`\[[^\]]*\]`'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span><span style="color: #000088;">$excerpt</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">.</span><span style="color: #000088;">$excerpt</span><span style="color: #339933;">.</span><span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This will get you a more flexible excerpt function than the default WordPress one, <code>the_excerpt()</code>.  I think I stole this from the <a href="http://bavotasan.com/downloads/feed-me-seymour-free-wordpress-theme/" title="FMS theme">Feed Me Seymour theme</a>. You can call the function with <code>theme_excerpt(n)</code> where <em>n</em> is the number of words in the excerpt.</p>
<p><em>I&#8217;m going to break this up into sections, so if you are copy-pasting, you will need to copy all the sections below or pick and choose carefully, otherwise you might end up with some unclosed tags.</em></p>
<p><strong>Preserving the Page text</strong><br />
Most of the text in a dynamic homepage is generated from feeds, posts, and database queries (i.e. not by adding it manually to the page called Home in your WordPress page list).  In some cases, your Home page could be totally blank when accessed from the default page editor.  However, you may want to give yourself the option of manually adding and updating text somewhere on your homepage.  In the example below, we keep the WordPress page text intact by calling <a href="http://codex.wordpress.org/The_Loop" title="The Loop @ WP">The Loop</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php
<span style="color: #666666; font-style: italic;">/*
Template Name: Home Page
*/</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;!--</span> get the <span style="color: #990000;">header</span> and sidebar<span style="color: #339933;">...</span> though sometimes you might want to leave the sidebar out of a Home template<span style="color: #339933;">.</span>  It<span style="color: #0000ff;">'s here just for the sake of illustration--&gt; 
&lt; ?php get_header(); ?&gt;
&lt; ?php get_sidebar(); ?&gt;
&nbsp;
&lt;div id=&quot;content&quot;&gt;
&nbsp;
&lt;!-- Homepage text from the page editor using '</span>The Loop<span style="color: #0000ff;">'--&gt;
         &lt; ?php if (have_posts()) : while (have_posts()) : the_post(); ?&gt;
		&lt;div class=&quot;post&quot; id=&quot;main-entry&quot;&gt;&lt;div id=&quot;in-border&quot;&gt;
&nbsp;
			&lt;div class=&quot;entry&quot;&gt;
				&lt; ?php the_content(); ?&gt;
			&lt;/div&gt;
				  &lt; ?php endwhile; endif; ?&gt;
		&lt;/div&gt;&lt;/div&gt;
&lt;/div&gt;</span></pre></div></div>

<p><strong>An Internal Category Feed</strong><br />
Below we have the latest one post from the &#8216;News&#8217; category.  You can repeat this with other categories as needed.  This is especially useful if you use the <a href="http://http://wordpress.org/extend/plugins/category-visibility-ipeat/" title="Category Visibility plug-in">Category Visibility plug-in</a> or some other means to hide/show certain category posts in certain areas of your site.  In a recent project, for example, we created additional page templates for displaying posts in certain categories (Calendar Events, Timeline Events, Lesson Plans), but excluded them from the blog loop.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!-- An internal feed.--&gt;
&lt;!-- The latest one post from the 'News' category --&gt;
&lt;!-- You can repeat this with other categories as needed.  --&gt;
&nbsp;
&nbsp;
&lt;li&gt;
&lt;h2&gt;News&lt;/h2&gt;
         &lt; ?php $my_query = new WP_Query('category_name=news&amp;showposts=1'); while ($my_query-&gt;have_posts()) : $my_query-&gt;the_post(); $do_not_duplicate = $post-&gt;ID; ?&gt;
&nbsp;
                &lt;!-- Link to the 'News' category --&gt;
    		&lt;div class=&quot;post&quot;&gt;
    		&lt;div id=&quot;link-contain&quot;&gt;
                &lt;p class=&quot;contread&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/news&quot;&gt;All News &amp;raquo;&lt;/a&gt;&lt;/p&gt;  
                &lt;/div&gt;
&nbsp;
    		&lt;h3&gt;Latest News&lt;/h3&gt;
&nbsp;
                &lt;!-- The post title --&gt;
		&lt;h3&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; rel=&quot;bookmark&quot; title=&quot;Permanent Link to &lt; ?php the_title(); ?&gt;&quot;&gt;&lt; ?php the_title(); ?&gt;&lt;/a&gt;&lt;/h3&gt;
			&lt;div class=&quot;entry&quot;&gt;
                &lt;!-- The post excerpt using custom function from theme/function.php --&gt;		
				&lt; ?php echo theme_excerpt(30); ?&gt; 
			&lt;/div&gt;
		&lt;/div&gt;
  &lt; ?php endwhile; ?&gt;
&lt;/li&gt;</pre></div></div>

<p><strong>An External Feed</strong><br />
This code uses the WordPress core functionality that brings feeds into your Dashboard.   I&#8217;m just pulling the title and link here, but you can do more.  This is especially useful if your site incorporates another platform besides WordPress.  In the example below, I use a feed from the Omeka platform (<a href="http://omeka.org">omeka.org</a>), which I had tucked into my root directory, masquerading as a native section of the site.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!-- An External Feed  --&gt;
&lt;!-- This is especially useful if your site incorporates another platform besides WordPress.--&gt;
&nbsp;
&lt;li&gt;
&lt;h2&gt;Collections &amp;amp; Exhibits &lt;/h2&gt;
    		&lt;div class=&quot;post&quot; id=&quot;omeka-feed&quot;&gt;
    		&lt;div id=&quot;link-contain&quot;&gt;&lt;p class=&quot;contread&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/omeka&quot;&gt;View the Archive &amp;raquo;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
			&lt;div class=&quot;entry&quot;&gt;
             &lt;!-- This code uses the WordPress core functionality that brings feeds into your Dashboard--&gt;
             &lt;!-- I'm just pulling the title and link here, but you can do more--&gt;
			&lt; ?php  
			require_once (ABSPATH . WPINC . '/rss.php');  
			$rss = @fetch_rss('http://www.myurl.org/omeka/items/browse?output=rss2');  
			if ( isset($rss-&gt;items) &amp;&amp; 0 != count($rss-&gt;items) ) {  
			?&gt;  
			&lt;h3&gt;Latest Additions&lt;/h3&gt;
			&lt;ul&gt;  
			&lt; ?php  
			$rss-&gt;items = array_slice($rss-&gt;items, 0,7);  
			foreach ($rss-&gt;items as $item ) {  
 			?&gt;  
			&lt;li&gt; 
			&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_filter_kses<span style="color: #009900;">&#40;</span><span style="color: #000088;">$item</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'link'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;
			&lt; ?php echo wp_specialchars($item['title']); ?&gt;  
			&lt;/a&gt;  
			&lt;/li&gt;  
			&lt; ?php } ?&gt;  
			&lt;/ul&gt;  
			&lt; ?php } ?&gt;  
			&lt;/div&gt;
&nbsp;
		&lt;/div&gt;
  &lt; ?php endwhile; ?&gt;
&lt;/li&gt;</pre></div></div>

<p><strong>A Special Plugin Feed (Simple:Press)</strong><br />
Lots of plugins generate their own feed.  Here we have an internal feed from the Simple:Press forum plugin (<a href="http://simplepressforum.com">simplepressforum.com</a>).  Such plug-ins generally use custom functions, such as the one below, the rules for which are defined in the plug-in documentation.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;!-- An internal feed from the Simple:Press forum plugin (simplepressforum.com)--&gt;
&lt;li&gt;
&lt;h2&gt;Discussions&lt;/h2&gt;
    		&lt;div class=&quot;post&quot; id=&quot;forum-posts&quot;&gt;
    		&lt;div id=&quot;link-contain&quot;&gt;&lt;p class=&quot;contread&quot;&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/forum&quot;&gt;View Forums &amp;raquo;&lt;/a&gt;&lt;/p&gt;&lt;/div&gt;
			&lt;div class=&quot;entry&quot;&gt;
			&lt;h3&gt;Latest Topics&lt;/h3&gt;
				&lt;ul&gt;
				&lt; ?php sf_recent_posts_tag(3, false, true, true, true, 0, false); ?&gt;
				&lt;/ul&gt;
&nbsp;
			&lt;/div&gt;
&nbsp;
		&lt;/div&gt;
&nbsp;
&lt;/li&gt;</pre></div></div>

<p><strong>Listing all Pages</strong><br />
Normally, you should list all your pages in the header navigation, but in this case I had too many pages to list there, some of which didn&#8217;t belong in the navigation.  I listed only the pages that were not part of the header navigation or the footer (About, Contact) in this section.  You can find more info about <code>wp_list_pages()</code> <a href="http://codex.wordpress.org/Template_Tags/wp_list_pages" title="wp_list_pages() @ WP">here</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;!--</span> <span style="color: #990000;">List</span> all parent pages and first level of child pages <span style="color: #339933;">--&gt;</span>
<span style="color: #339933;">&lt;</span>li<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h2<span style="color: #339933;">&gt;</span>More<span style="color: #339933;">&lt;/</span>h2<span style="color: #339933;">&gt;</span>
&nbsp;
    	<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;post&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;more-list&quot;</span><span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;</span>h3<span style="color: #339933;">&gt;&lt;</span> ?php wp_list_pages<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'title_li=&amp;depth=2exclude=1,2,3,4,5,6'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span><span style="color: #339933;">&lt;/</span>h3<span style="color: #339933;">&gt;</span>
			<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span>
	<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>li<span style="color: #339933;">&gt;</span></pre></div></div>

<p>If you are copy-pasting, don&#8217;t forget to add the footer to end your page</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span> ?php get_footer<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Of course, there are plenty more tricks out there.  Frankly, these aren&#8217;t that special, but they seem fundamental.  If this helps you, let us know in the comments.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffersonsnewspaper.org/2009/building-a-wordpress-static-homepage-with-dynamic-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
