<?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>Maverick Web Creations &#187; smoothgallery</title>
	<atom:link href="http://www.maverickwebcreations.com/tag/smoothgallery/feed" rel="self" type="application/rss+xml" />
	<link>http://www.maverickwebcreations.com</link>
	<description></description>
	<lastBuildDate>Fri, 03 Feb 2012 05:37:11 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>How to Integrate SmoothGallery into WordPress</title>
		<link>http://www.maverickwebcreations.com/2008/10/18/how-to-integrate-smoothgallery-into-wordpress.html</link>
		<comments>http://www.maverickwebcreations.com/2008/10/18/how-to-integrate-smoothgallery-into-wordpress.html#comments</comments>
		<pubDate>Sat, 18 Oct 2008 00:00:21 +0000</pubDate>
		<dc:creator>admin_mwc</dc:creator>
				<category><![CDATA[Wordpress Help]]></category>
		<category><![CDATA[slideshow]]></category>
		<category><![CDATA[smoothgallery]]></category>
		<category><![CDATA[WordPress]]></category>
		<guid isPermaLink="false">http://www.maverickwebcreations.com/?p=217</guid>
		<description><![CDATA[<p>I wanted to recreate the SmoothGallery effect for my own blog designs without installing the popular <a href="http://justintadlock.com/archives/2008/02/24/options-wordpress-theme">Options WordPress Theme</a>. I did some research and found this <a href="http://www.christianschenk.org/projects/wordpress-smoothgallery-plugin/">WordPress SmoothGallery plugin</a> that I found very hard to set up. Then I read a tutorial on <a href="http://www.catswhocode.com/blog/featured/how-to-integrate-a-slideshow-in-your-wordpress-theme-120">how to integrate a slideshow in </a>&#8230; <a href="http://www.maverickwebcreations.com/2008/10/18/how-to-integrate-smoothgallery-into-wordpress.html" class="read_more">Read more...</a></p>]]></description>
			<content:encoded><![CDATA[<p>I wanted to recreate the SmoothGallery effect for my own blog designs without installing the popular <a href="http://justintadlock.com/archives/2008/02/24/options-wordpress-theme">Options WordPress Theme</a>. I did some research and found this <a href="http://www.christianschenk.org/projects/wordpress-smoothgallery-plugin/">WordPress SmoothGallery plugin</a> that I found very hard to set up. Then I read a tutorial on <a href="http://www.catswhocode.com/blog/featured/how-to-integrate-a-slideshow-in-your-wordpress-theme-120">how to integrate a slideshow in a WordPress theme</a> and that was perfect for me.</p>
<p>This blog post will document my implementation of the SmoothGallery with special thanks to CatsWhoCode.com for the inspiration. I use SmoothGallery to highlight certain posts on my web site. You could use it for to display photos too. For web designers like me, you could use it to highlight your portfolio.</p>
<p><strong>Step 1: Download SmoothGallery and Mootools</strong></p>
<p>At the time of this writing, the latest version of <a href="http://smoothgallery.jondesign.net/download/">SmoothGallery 2.0</a> and it includes Mootools 1.11.</p>
<p><strong>Step 2: Copy the Javascript and CSS Files to Your WordPress Theme&#8217;s Folder</strong></p>
<p>I like to organize my WordPress themes like this:</p>
<p>/wp-content/themes/mytheme/css &#8211; This is where I store all my CSS files other than the stye.css file.<br />
/wp-content/themes/mytheme/js &#8211; This where I store all my Javascript files.</p>
<p>It does not really matter where you store the files but just make sure the following files are somewhere in your theme folder:</p>
<ol>
<li>jd.gallery.css</li>
<li>mootools.v1.11.js</li>
<li>jd.gallery.js</li>
</ol>
<p><strong>Step 3: Add the SmoothGallery File References to Your WordPress Theme&#8217;s header.php File</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;head&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/css/jd.gallery.css&quot; /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/js/mootools.v1.11.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/js/jd.gallery.js&quot;&gt;&lt;/script&gt;
&lt;/head&gt;
</pre>
<p>Insert the 3 lines above in between the 2 head tags.</p>
<pre class="brush: php; title: ; notranslate">
&lt;head&gt;
&lt;?php
#DISPLAY SMOOTHGALLERY
if(is_home())
{
?&gt;
&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; media=&quot;screen&quot; href=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/css/jd.gallery.css&quot; /&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/js/mootools.v1.11.js&quot;&gt;&lt;/script&gt;
&lt;script type=&quot;text/javascript&quot; src=&quot;&lt;?php echo bloginfo('template_directory'); ?&gt;/js/jd.gallery.js&quot;&gt;&lt;/script&gt;
&lt;?php
}
?&gt;
&lt;/head&gt;
</pre>
<p>If you only plan to display the SmoothGallery on your home page, which is how it is displayed on WordPress blogs most of the time, use the is_home() function as above.</p>
<p><strong>Step 4: Create a Category for the SmoothGallery Content</strong></p>
<p>Create a new category for the posts that will be displayed in the SmoothGallery by going to &#8220;Manage&#8221; -> &#8220;Categories&#8221;.</p>
<p><a href="http://www.maverickwebcreations.com/wp-content/uploads/2008/10/2008-10-17_130828.png"><img src="http://www.maverickwebcreations.com/wp-content/uploads/2008/10/2008-10-17_130828.png" alt="How to Integrate SmoothGallery into WordPress" title="SmoothGallery Category" width="500" height="105" class="alignnone size-full wp-image-233" /></a></p>
<p>Once you have created a category, move your mouse cursor over the category name to reveal the edit link. Take note of the category ID of the category, which is seen in the last character of the URL. e.g. cat_ID=5.</p>
<p><strong>Step 5: Add the SmoothGallery Code to Your WordPress Template</strong></p>
<pre class="brush: php; title: ; notranslate">
&lt;!--INITIALIZE SMOOTH GALLERY--&gt;
&lt;script type=&quot;text/javascript&quot;&gt;
function startGallery()
{
	var myGallery = new gallery($('myGallery'),
	{
		timed: true,
		showCarousel: false
	});
}
window.addEvent('domready', startGallery);
&lt;/script&gt;
&lt;div id=&quot;myGallery&quot;&gt;
&lt;?php
#RETRIEVE THE SMOOTH GALLERY POSTS
$smoothgallery_posts = new WP_Query('cat=120&amp;posts_per_page=5');
#DISPLAY SMOOTH GALLERY ELEMENTS
while($smoothgallery_posts-&gt;have_posts())
{
	$smoothgallery_posts-&gt;the_post();
	#RETRIEVE THE SMOOTH GALLERY IMAGE URL
	$picture = get_post_meta($post-&gt;ID, 'picture', true);
	#RETRIEVE THE SMOOTH GALLERY URL
	$url = get_post_meta($post-&gt;ID, 'url', true);
	#SMOOTH GALLERY IMAGE URL EXISTS
	if(!empty($picture))
	{
	?&gt;
		&lt;!-- SMOOTH GALLERY ELEMENT - START --&gt;
		&lt;div class=&quot;imageElement&quot;&gt;
			&lt;h3&gt;&lt;?php the_title(); ?&gt;&lt;/h3&gt;
			&lt;?php the_excerpt(); ?&gt;
			&lt;?php
			#SMOOTH GALLERY URL EXISTS
			if(!empty($url))
			{
			?&gt;
			&lt;a href=&quot;&lt;?php echo $url; ?&gt;&quot; title=&quot;Read more&quot; class=&quot;open&quot;&gt;&lt;/a&gt;
			&lt;?php
			}
			#SMOOTH GALLERY URL DOES NOT EXIST - USE POST URL
			else
			{
			?&gt;
			&lt;a href=&quot;&lt;?php the_permalink(); ?&gt;&quot; title=&quot;Read more&quot; class=&quot;open&quot;&gt;&lt;/a&gt;
			&lt;?php
			}
			?&gt;
			&lt;img src=&quot;&lt;?php echo $picture; ?&gt;&quot; class=&quot;full&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot;/&gt;
			&lt;img src=&quot;&lt;?php echo $picture; ?&gt;&quot; class=&quot;thumbnail&quot; alt=&quot;&lt;?php the_title(); ?&gt;&quot;/&gt;
		&lt;/div&gt;
		&lt;!-- SMOOTH GALLERY ELEMENT - END --&gt;
	&lt;?php
	}
}
?&gt;
</pre>
<p>Let me explain how my code works&#8230;</p>
<pre class="brush: php; title: ; notranslate">
#RETRIEVE THE SMOOTH GALLERY POSTS
$smoothgallery_posts = new WP_Query('cat=120&amp;posts_per_page=5');
</pre>
<p>You need to replace the number 120 with the category number you got from the previous step. You may also control the number of posts you wish to display in your SmoothGallery by changing the number in &#8220;posts_per_page=5&#8243;. For example, if you wish to display 10 posts, edit it to &#8220;posts_per_page=10&#8243;.</p>
<p>Once you have edited this code, it is time to post some content to the SmoothGallery!</p>
<p><strong>Step 6: Add Content to the SmoothGallery</strong></p>
<p><img src="http://www.maverickwebcreations.com/wp-content/uploads/2008/10/smooth-gallery.jpg" alt="How to Integrate SmoothGallery into WordPress" title="SmoothGallery" width="468" height="934" class="alignnone size-full wp-image-241" /></p>
<p>Add a new post into the category you created above. You may leave the content blank if you want but it is recommended that you include a short description of the post in the excerpt, which appears in the SmoothGallery.</p>
<p>I also use 2 custom fields. The &#8220;picture&#8221; custom field is compulsory and you will have to add a URL of a picture to it. The &#8220;url&#8221; custom field is optional. This field tells SmoothGallery to redirect the reader to another URL. If you ignore this, the default URL will be the post&#8217;s URL.</p>
<p><strong>Step 7: Fix Some SmoothGallery Bugs!</strong></p>
<p>Not a lot of people talk about these bugs but I know they can be a pain if you don&#8217;t fix them. I encountered 2 bugs when I first started using SmoothGallery:</p>
<p><strong>1. Can&#8217;t Display SmoothGallery if You Only Have 1 Post</strong></p>
<p>I found a <a href="http://smoothgallery.jondesign.net/forums/viewtopic.php?pid=2505#p2505">fix for this at the SmoothGallery forums</a>. Here&#8217;s what you need to do in the file jd.gallery.js:</p>
<pre class="brush: jscript; title: ; notranslate">
if ((this.galleryData.length&gt;1)&amp;&amp;(this.options.showArrows))
{
	var leftArrow = new Element('a').addClass('left').addEvent(
		'click',
		this.prevItem.bind(this)
	).injectInside(element);
	var rightArrow = new Element('a').addClass('right').addEvent(
		'click',
		this.nextItem.bind(this)
	).injectInside(element);
	this.galleryElement.addClass(this.options.withArrowsClass);
}
</pre>
<p>This is the original code. You need to move the code in line 128 outside the curly brackets like this:</p>
<pre class="brush: jscript; title: ; notranslate">
if ((this.galleryData.length&gt;1)&amp;&amp;(this.options.showArrows))
{
	var leftArrow = new Element('a').addClass('left').addEvent(
		'click',
		this.prevItem.bind(this)
	).injectInside(element);
	var rightArrow = new Element('a').addClass('right').addEvent(
		'click',
		this.nextItem.bind(this)
	).injectInside(element);
}
this.galleryElement.addClass(this.options.withArrowsClass); /* 1 image bug fix */
</pre>
<p>Once you have applied this fix, your SmoothWall will appear when you have only 1 post.</p>
<p><strong>2. The Left and Right Arrows Don&#8217;t &#8220;Animate&#8221; in Internet Explorer</strong></p>
<p>Again, I found a fix for this bug at the <a href="http://smoothgallery.jondesign.net/forums/viewtopic.php?id=20">SmoothGallery forums</a>.</p>
<pre class="brush: css; title: ; notranslate">
*:first-child+html .slideInfoZone
{
    bottom: -1px;
}
*:first-child+html .jdGallery a.right, *:first-child+html .jdGallery a.left
{
    filter:alpha(opacity=20);
}
*:first-child+html .jdGallery a.right:hover, *:first-child+html .jdGallery a.left:hover
{
    filter:alpha(opacity=80);
}
*:first-child+html .jdGallery a.left { background: url('img/fleche1.gif') no-repeat center left; }
*:first-child+html .jdGallery a.right { background: url('img/fleche2.gif') no-repeat center right; }
*:first-child+html a.open:hover { background: url('img/open.gif') no-repeat center center;
    filter:alpha(opacity=80); }
</pre>
<p>Add the code above to the jd.gallery.css file and it should fix that bug once and for all. You should see the arrows flashing from dim to bright when you move your mouse over it.</p>
<p><strong>Step 7: Styling the SmoothGallery</strong></p>
<p>I can&#8217;t cover everything about styling the SmoothGallery to suit your needs here because our web site designs are different. What I can do is point out the things you should edit in the jd.gallery.css file.</p>
<pre class="brush: css; title: ; notranslate">
/* SMOOTH GALLERY */
#myGallery, #myGallerySet, #flickrGallery
{
	display: block;
	height: 380px;
	margin: 0px 3px 10px 10px;
	border: 1px solid #EDEDED;
}
/* SMOOTH GALLERY TITLE */
.jdGallery .slideInfoZone h2
{
	margin: 0px;
	padding: 0px;
	font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;
	font-size: 13px;
	font-weight: bold;
	color: #FFFFFF;
}
/* SMOOTH GALLERY DESCRIPTION */
.jdGallery .slideInfoZone p
{
	margin: 0px;
	padding: 0px;
	font-family: Georgia, &quot;Times New Roman&quot;, Times, serif;
	font-size: 13px;
	color: #FFFFFF;
}
</pre>
<p>If you would like to align the pictures in the SmoothGallery to the left or right, you need to <a href="http://smoothgallery.jondesign.net/forums/viewtopic.php?id=1697">apply a fix to the jd.gallery.js</a> again&#8230;</p>
<pre class="brush: jscript; title: ; notranslate">
'backgroundPosition':&quot;center center&quot;,
</pre>
<p>The code above is the default setting that aligns the picture to the centre of the SmoothGallery.</p>
<pre class="brush: jscript; title: ; notranslate">
'backgroundPosition':&quot;center left&quot;,
</pre>
<p>Change the second center word to left and you picture should align to the left of the SmoothGallery.</p>
<pre class="brush: jscript; title: ; notranslate">
'backgroundPosition':&quot;center right&quot;,
</pre>
<p>Change the second center word to right and you picture should align to the right of the SmoothGallery.</p>
<p><strong>A Live Working Example&#8230;</strong></p>
<p>Just take a look at my home page to see it in action. I hope this post helped you in some way to enhance your WordPress site with the SmoothGallery script.</p>
<p>In a future post, I will cover more advanced SmoothGallery enhancements to make your web site look cool by hiding the SmoothGallery posts outside of the SmoothGallery. The biggest disadvantage of using SmoothGallery this way is that it requires you to sacrifice a category and the posts look kind of odd in your blog archives.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.maverickwebcreations.com/2008/10/18/how-to-integrate-smoothgallery-into-wordpress.html/feed</wfw:commentRss>
		<slash:comments>27</slash:comments>
		</item>
	</channel>
</rss>

