<?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>The Rambling Chronicles: Notes &#187; gallery2</title>
	<atom:link href="http://notes.theramblingchronicles.co.uk/tags/gallery-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://notes.theramblingchronicles.co.uk</link>
	<description>Making sense is optional</description>
	<lastBuildDate>Thu, 26 Aug 2010 10:09:56 +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>WPG2 and new theme</title>
		<link>http://notes.theramblingchronicles.co.uk/2008/08/24/wpg2-and-new-theme/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2008/08/24/wpg2-and-new-theme/#comments</comments>
		<pubDate>Sun, 24 Aug 2008 15:55:25 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[gallery2]]></category>
		<category><![CDATA[site]]></category>
		<category><![CDATA[theme]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://theramblingchronicles.co.uk/?p=74</guid>
		<description><![CDATA[After failing to find a theme for my blog I liked well enough, I finally took the plunge and designed this one, as much as possible from scratch. There&#8217;s stuff in from the default theme, as well as good colours from all over the place. I may eventually release it when I&#8217;m sure that it&#8217;s [...]]]></description>
			<content:encoded><![CDATA[<p>After failing to find a theme for my blog I liked well enough, I finally took the plunge and designed this one, as much as possible from scratch. There&#8217;s stuff in from the default theme, as well as good colours from all over the place. I may eventually release it when I&#8217;m sure that it&#8217;s actually complete, and that weird bugs are mostly ironed out.</p>

<p>The plus side is that the <a href="http://wordpress.org/extend/plugins/wpg2/"><span class="caps">WPG2</span></a> plugin I couldn&#8217;t get to work on my previous theme now works perfectly, which is good news as I can stop using the kludged together iframe tag gallery page I used before.</p>

<p>The only problem I encountered was using the <code>wp_list_bookmarks()</code> function so that I could use WordPress&#8217;s built in link manager. The default list outputs the description seemingly as an afterthought, which is very annoying when you would like to style it. Using <code>get_bookmarks()</code> is more flexible but doesn&#8217;t allow you to pull out the categories.</p>

<p>By digging into the core files I found out how the WordPress team did it, and wrote my own (much simpler) bit of code, put it in as a template and produced my own links section with a styleable link description:</p>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Place this in a template<span style="color: #339933;">,</span> I called mine links
	<span style="color: #339933;">&lt;</span>ul <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;link-list&quot;</span><span style="color: #339933;">&gt;</span>
&nbsp;
	<span style="color: #339933;">&lt;</span> ?php
&nbsp;
		<span style="color: #666666; font-style: italic;">// This line gets all of the link categories</span>
		<span style="color: #000088;">$cats</span> <span style="color: #339933;">=</span> get_terms<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'link_category'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name__like'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'include'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'exclude'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'orderby'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'name'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'order'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'hierarchical'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// loop through the categories</span>
		<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cats</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Put the categories into a list</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li id='linkcat-&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' class='linkcat'&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;h2&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/h2&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Get the bookmarks that are a part of the current category in the loop</span>
			<span style="color: #000088;">$bookmarks</span> <span style="color: #339933;">=</span> get_bookmarks<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'category'</span><span style="color: #339933;">=&gt;</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">term_id</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;ul&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #666666; font-style: italic;">// Loop through each of the bookmarks that are part of the category</span>
			<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bookmarks</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$bookmark</span><span style="color: #009900;">&#41;</span>
			<span style="color: #009900;">&#123;</span>
&nbsp;
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;li&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' &gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// if the link description exists, output this</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_description</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot; &amp;raquo; &quot;</span><span style="color: #339933;">;</span>
&nbsp;
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;div class='link-description'&gt;&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_description</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #666666; font-style: italic;">// If an image exists as part of the link, output that.</span>
				<span style="color: #666666; font-style: italic;">// The image is linked to the URL of the link it is a part of</span>
				<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_image</span><span style="color: #009900;">&#41;</span>
				<span style="color: #009900;">&#123;</span>
&nbsp;
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;div&gt;&quot;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;a href='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_url</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' &gt;&quot;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;img src='&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-/&gt;</span>link_image<span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' alt='Image for &quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$bookmark</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">link_name</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;' /&gt;&quot;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/a&gt;&quot;</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/div&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
				<span style="color: #009900;">&#125;</span>
&nbsp;
				<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #009900;">&#125;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/ul&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
			<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/li&gt;&quot;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #009900;">&#125;</span>
	<span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span></pre></div></div>
]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2008/08/24/wpg2-and-new-theme/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress and Gallery 2</title>
		<link>http://notes.theramblingchronicles.co.uk/2008/06/24/wordpress-and-gallery-2/</link>
		<comments>http://notes.theramblingchronicles.co.uk/2008/06/24/wordpress-and-gallery-2/#comments</comments>
		<pubDate>Tue, 24 Jun 2008 18:47:58 +0000</pubDate>
		<dc:creator>Tom</dc:creator>
				<category><![CDATA[stuff]]></category>
		<category><![CDATA[gallery2]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://theramblingchronicles.co.uk/?p=45</guid>
		<description><![CDATA[There appear to be two ways of doing this: WP2G plugin This way is supposed to be quick and painless, but I found it was pretty much the other way. Lots of things you need to do to get initially setup, and does not integrate well with themes that are not specifically designed for it1. [...]]]></description>
			<content:encoded><![CDATA[<p>There appear to be two ways of doing this:</p>

<ul>
<ol><strong><span class="caps">WP2G </span>plugin</strong>

This way is supposed to be quick and painless, but I found it was pretty much the other way. Lots of things you need to do to get initially setup, and does not integrate well with themes that are not specifically designed for it<sup class='footnote'><a href='#fn-45-1' id='fnref-45-1'>1</a></sup>. Overall, a lot of effort.</ol>

<ol><strong>use an iframe</strong>

Ok, not <span class="caps">XHTML </span>strict compaitible, so you could use the object tag<sup class='footnote'><a href='#fn-45-2' id='fnref-45-2'>2</a></sup>, but this does allow the gallery to work flawlessly without any fuss, apart from long pages causing scroll bars. The gallery was embedded in a page using the template system, and is currently hard coded. This isn&#8217;t perfect, but it works.</ol>

</ul>

The widgets that come with the <span class="caps">WP2G </span>plugin are tightly integrated with it, so I ended up making my own. Needs a lot of work before I can release it though, as it&#8217;s current state is about as secure as a prison made of jelly.<div class='footnotes'><div class='footnotedivider'></div><ol><li id='fn-45-1'>strange things happened with this one, causing the gallery to appear in the sidebar <span class='footnotereverse'><a href='#fnref-45-1'>&#8617;</a></span></li><li id='fn-45-2'>Something I&#8217;ll get around to doing myself <span class='footnotereverse'><a href='#fnref-45-2'>&#8617;</a></span></li></ol></div>]]></content:encoded>
			<wfw:commentRss>http://notes.theramblingchronicles.co.uk/2008/06/24/wordpress-and-gallery-2/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
