<?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>things with bits</title>
	<atom:link href="http://thingswithbits.info/feed/" rel="self" type="application/rss+xml" />
	<link>http://thingswithbits.info</link>
	<description>— frances d&#039;ath (berlin)</description>
	<lastBuildDate>Thu, 15 Dec 2011 21:07:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<item>
		<title>thingswithbits updated</title>
		<link>http://thingswithbits.info/news/thingswithbits-updated/</link>
		<comments>http://thingswithbits.info/news/thingswithbits-updated/#comments</comments>
		<pubDate>Fri, 11 Nov 2011 13:11:27 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[Design]]></category>
		<category><![CDATA[News]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=394</guid>
		<description><![CDATA[I&#8217;ve been occupied with several other websites, designing, and other non-here things in the past months, and really wanted to not look at the old template I was using as a stand-in here. So I spent a few hours last night trying something. Then I threw it out. This is a contingent design, based on [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been occupied with several other websites, designing, and other non-here things in the past months, and really wanted to not look at the old template I was using as a stand-in here. So I spent a few hours last night trying something. Then I threw it out.</p>
<p>This is a contingent design, based on the theme I use on <a href="http://francesdath.info" target="_blank">francesdath.info</a>, with much stripped out and some other things thrown in (it also is not finished, so expect broken pieces). It&#8217;s far more minimal than I originally intended, but somehow this is enough for me.</p>
<p>I&#8217;m also not sure how I&#8217;ll use the news section anymore, as I don&#8217;t really have the time to do everything in my life and write about code and design — especially when <a href="http://supernaut.info" target="_blank">supernaut</a> has been alive for over seven years. Perhaps just to use it to mention more briefly whatever it is I happen to be doing in design.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/thingswithbits-updated/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Some ways to customise the WordPress Visual Editor and HTML Editor</title>
		<link>http://thingswithbits.info/news/some-ways-to-customise-the-wordpress-visual-editor-and-html-editor/</link>
		<comments>http://thingswithbits.info/news/some-ways-to-customise-the-wordpress-visual-editor-and-html-editor/#comments</comments>
		<pubDate>Tue, 28 Jun 2011 10:30:24 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Typography]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=287</guid>
		<description><![CDATA[What started out as just wanting to add some buttons to the visual editor for standard html tags like &#60;cite&#62; and &#60;ins&#62; turned into something of a leviathan. Without a plugin, such as TinyMCE Advanced, there isn&#8217;t a non-code way to make changes, and even this plugin or others which can extend the TinyMCE editor [...]]]></description>
			<content:encoded><![CDATA[<p>What started out as just wanting to add some buttons to the visual editor for standard html tags like &lt;cite&gt; and &lt;ins&gt; turned into something of a leviathan. Without a plugin, such as TinyMCE Advanced, there isn&#8217;t a non-code way to make changes, and even this plugin or others which can extend the TinyMCE editor are fairly limited to either rearranging what&#8217;s there, adding the standard extended sets, or adding styles to the styles menu.</p>
<p>After my moderate success with adding new custom buttons, I decided for something a little more ambitious. What I wanted turned out to be unnecessarily difficult and I still don&#8217;t have an ideal solution: I simply wanted to columnise text content. I thought I had the answer with CSS3 columns, which are in principle brilliant, but in use turned out to have all kinds of limitations and weirdnesses (and I&#8217;m not talking about lack of Internet Explorer support, which can anyway be worked around with columnizer.js or other methods). So … how about a custom button that will wrap text in something like &lt;div class=&#8221;column-left&#8221;&gt;?</p>
<h5>Cleaning up and ordering the Visual Editor buttons</h5>
<p>First things first. The visual editor has quite a few buttons that are either never going to get used, or shouldn&#8217;t get used. How about cleaning up that and arranging everything so that the buttons match the available text formatting options in a somewhat intuitive way? This is the simplest thing and goes in functions.php</p>
<p>On a sidenote, I have started splitting off everything from functions.php and putting code for specific tasks into separate files in a folder called &#8216;functions&#8217;, and then use PHP&#8217;s &#8216;include&#8217;, in the functions.php, like so:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">include</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;functions/functions-tinymce.php&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The standard TinyMCE editor can have several rows for buttons, but really two is more than enough. To arrange the order of the buttons and choose which ones you want, this is what&#8217;s necessary:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//tinymce row 1</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'my_tinymce_row_1'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> my_tinymce_row_1<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buttons</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'formatselect'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'bold'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'italic'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'underline'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sub'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sup'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'strikethrough'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'inser'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'cite'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'blockquote'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'bullist'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'numlist'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'link'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unlink'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'anchor'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'outdent'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'indent'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'charmap'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'separator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_image'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_video'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_audio'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_media'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'separator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fullscreen'</span><span style="color: #339933;">,</span> &nbsp;<span style="color: #0000ff;">'fullscreen'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_adv'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mce_buttons&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;my_tinymce_row_1&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #666666; font-style: italic;">//tinymce row 2</span><br />
<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'my_tinymce_row_2'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">function</span> my_tinymce_row_2<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buttons</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pastetext'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'pasteword'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'removeformat'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'spellchecker'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_help'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mce_buttons_2&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;my_tinymce_row_2&quot;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>I prefix the function name with the website name to keep everything coherent, so instead of my_tinymce_row_1, I would have, e.g. fangxishi_tinymce_row_1</p>
<p>The important stuff is in returning the array of buttons. There is a list of standard buttons, but also you can use the inspector and select any button in the Visual Editor to find its name, e.g:</p>
<div class="codecolorer-container html4strict default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">td</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content_charmap&quot;</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;javascript:;&quot;</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mceButton mceButtonEnabled mce_charmap&quot;</span> <span style="color: #000066;">onmousedown</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return false;&quot;</span> <span style="color: #000066;">onclick</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;return false;&quot;</span> <span style="color: #000066;">title</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;Insert custom character&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;mceIcon mce_charmap&quot;</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">td</span>&gt;</span></div></td></tr></tbody></table></div>
<p>For the character map, looking in <span> there is &#8216;mce_charmap&#8217;. Just get rid of &#8216;mce_&#8217; and that&#8217;s the buttons&#8217; name.</p>
<p>I also added the &#8216;add media&#8217; buttons, which I thought would be useful when I was trying the idea to use two visual editors to split content into two columns.</p>
<p>You can also do the same for the Format dropdown menu.</p>
<p>Then I wanted to add a button for &#8216;cite&#8217; and &#8216;ins&#8217;, both of which are in TinyMCE Advanced, but I didn&#8217;t want a whole plugin for this. Unlike most of WordPress stuff, this is getting into seriously poorly documented territory, and it took quite a while to find something close to useful that I could then hack into shape.</p>
<h5>Basic Styles dropdown menu formatting</h5>
<p>Why not use the Styles dropdown menu, which is simple and well-documented? Well, yes. For things when you just need &lt;span class=&#8221;foo&#8221;&gt;, this works fine. To make a drop-caps style:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'my_tinymce_styles'</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span><br />
<span style="color: #000000; font-weight: bold;">function</span> my_formatTinyMCE<span style="color: #009900;">&#40;</span><span style="color: #000088;">$init</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$init</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'theme_advanced_buttons2_add'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'styleselect'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$init</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'theme_advanced_styles'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'Drop Caps=drop-cap'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$init</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
<br />
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'tiny_mce_before_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_tinymce_styles'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>The name in the styles dropdown menu will be &#8216;Drop Caps&#8217; and the class added to the span will be &#8220;drop-caps&#8221;, then style with CSS.</p>
<p>For anything more complicated (i.e. not in a &lt;span&gt;) …</p>
<h5>Adding a custom button</h5>
<p>The code for this gets split into two parts; first that in functions.php, which then calls a js file.</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">//add cite button</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> add_cite_button<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// can user edit? then continue</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_posts'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_pages'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666; font-style: italic;">// add in visual editor only</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> get_user_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rich_editing'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'true'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp;add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;mce_external_plugins&quot;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;add_cite_tinymce_plugin&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'mce_buttons'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'register_cite_button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
<span style="color: #000000; font-weight: bold;">function</span> register_cite_button<span style="color: #009900;">&#40;</span><span style="color: #000088;">$buttons</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #990000;">array_push</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$buttons</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;cite&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000088;">$buttons</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// load tinymce plugin </span><br />
<span style="color: #000000; font-weight: bold;">function</span> add_cite_tinymce_plugin<span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin_array</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #000088;">$plugin_array</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'cite'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/functions/tinymce/cite_editor_plugin.js'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">return</span> <span style="color: #000088;">$plugin_array</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> my_refresh_mce<span style="color: #009900;">&#40;</span><span style="color: #000088;">$ver</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; <span style="color: #000088;">$ver</span> <span style="color: #339933;">+=</span> <span style="color: #cc66cc;">3</span><span style="color: #339933;">;</span><br />
&nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$ver</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'tiny_mce_version'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_refresh_mce'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_cite_button'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Without going into too much depth (because I just wanted to get things working), firstly this checks to see if a user has permissions to edit. If yes, then add the custom button only to the Visual Editor. Then register a new button, here called &#8216;cite&#8217;, and following that, load the custom code for that button, the &#8216;cite_editor_plugin.js&#8217;. Then force TinyMCE to clear its cache before adding everything.</p>
<p>Then we move over to the js.</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; tinymce.<span style="color: #660066;">create</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'tinymce.plugins.cite'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; init <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>ed<span style="color: #339933;">,</span> url<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ed.<span style="color: #660066;">addButton</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cite'</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; title <span style="color: #339933;">:</span> <span style="color: #3366CC;">'Cite Text'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; image <span style="color: #339933;">:</span> url<span style="color: #339933;">+</span><span style="color: #3366CC;">'/cite.png'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; onclick <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">setContent</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'&lt;cite&gt;'</span> <span style="color: #339933;">+</span> ed.<span style="color: #660066;">selection</span>.<span style="color: #660066;">getContent</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">+</span> <span style="color: #3366CC;">'&lt;/cite&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; createControl <span style="color: #339933;">:</span> <span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span>n<span style="color: #339933;">,</span> cm<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">null</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; tinymce.<span style="color: #660066;">PluginManager</span>.<span style="color: #660066;">add</span><span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'cite'</span><span style="color: #339933;">,</span> tinymce.<span style="color: #660066;">plugins</span>.<span style="color: #660066;">cite</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Whereas the code in functions.php is generic and will simply initiate the adding of a new button, the button itself needs to be made. In this case it wraps the selected text in the &lt;cite&gt; tags. A custom button image is used (which I took from TInyMCE). Here, clicking the &#8216;cite&#8217; button will wrap any selected text in &lt;cite&gt; tags. This is done with &#8216;ed.selection.setContent&#8217;. Other options are possible, for example opening a popup for adding data for shortcodes, depending on the function used here.</p>
<p>As with any other buttons, this can be added and arranged in the Visual Editor with the previous code.</p>
<h5>Advanced Styles dropdown menu items</h5>
<p>Having successfully added the missing styles, and cleaned up the menu, I started to think about how I could implement a user-based two-column option. I tried some shortcodes and other plugins that were meant to do this, but with how the website I&#8217;ve been working on was built, these didn&#8217;t work. Anyway, I like to have my own code.</p>
<p>To really make the Styles menu useful, we can build arrays that works with the buttons themselves.</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> site_columns_init<span style="color: #009900;">&#40;</span><span style="color: #000088;">$settings</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$style_formats</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Column Left'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'block'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'div'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'classes'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'column-links'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'wrapper'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Column Right'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'block'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'div'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'classes'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'column-rechts'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'wrapper'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$settings</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'style_formats'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #990000;">json_encode</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$style_formats</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$settings</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'tiny_mce_before_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'site_columns_init'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> site_columns<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$buttons</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #990000;">array_unshift</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$buttons</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'styleselect'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$buttons</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'mce_buttons_2'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'site_columns'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Make an array, give the Styles menu item a title element (e.g. div), a class name and add it to the Styles menu.  (Make sure the styles menu has also been added to the first code&#8217;s array of menu items) There are quite a few other options that can be used with this also, <a href="http://alisothegeek.com/2011/05/tinymce-styles-dropdown-wordpress-visual-editor/" target="_blank">alisothegeek covers it very well</a>.</p>
<p>Unfortunately, while this works brilliantly for a lot of things, for making columns it fails simply because this doesn&#8217;t work across paragraphs, that is to say it wraps only complete paragraphs in the div and won&#8217;t allow for half the text of a single paragraph in each column.</p>
<h5>Styling the HTML quicktags</h5>
<p>In the end I opted for the not-quite ideal method of jumping into the HTML editor for columnising. This, unlike adding new menu items or most other things associated with the Visual Editor, is simple and quick (<a href="http://scribu.net/wordpress/right-way-to-add-custom-quicktags.html" target="_blank">found on scribu</a>).</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> site_custom_quicktags<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; wp_enqueue_script<span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #0000ff;">'site_custom_quicktags'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_url'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/functions/quicktags/custom-quicktags.js'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'quicktags'</span> <span style="color: #009900;">&#41;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_print_scripts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'site_custom_quicktags'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>It barely needs explaining. Load a new button from a .js file after the quicktags menu has loaded. In the .js file, it&#8217;s one line per button:</p>
<div class="codecolorer-container javascript default" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">edButtons<span style="color: #009900;">&#91;</span>edButtons.<span style="color: #660066;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> edButton<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'col l'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'col-l'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&lt;div class=&quot;column-links&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
edButtons<span style="color: #009900;">&#91;</span>edButtons.<span style="color: #660066;">length</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #003366; font-weight: bold;">new</span> edButton<span style="color: #009900;">&#40;</span> <span style="color: #3366CC;">'col r'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'col-r'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&lt;div class=&quot;column-rechts&quot;&gt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">'&lt;/div&gt;'</span><span style="color: #339933;">,</span> <span style="color: #3366CC;">''</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>This makes two buttons which wrap any content in a div with class &#8216;left&#8217; or &#8216;right&#8217;, which can then be styled in CSS into columns. It&#8217;s also a bit rough, and can mess with paragraph formatting when swapping back and forth between editors, but is as close as I&#8217;ve found yet to a workable multi-column option.</p>
<h5>Multiple columns using multiple visual editors?</h5>
<p>This was my last thought, and in practice, if the post editor page is built appropriately, it&#8217;s probably the most controllable option.</p>
<p>I use <a href="http://www.farinspace.com/wpalchemy-metabox/" target="_blank">WPalchemy</a> for building all my metaboxes, and won&#8217;t go through the whole process for this here. WPAlchemy is very simple to set up and get working (even in some of the unorthodox situations I&#8217;m using it in), and Dimas has made a quick addition to the code which allows for <a href="http://www.farinspace.com/multiple-wordpress-wysiwyg-visual-editors/" target="_blank">multiple Visual Editors</a>. All the above code also works with these, and outputting the content into two separate left and right column divs in the template is trivial.</p>
<h5>Ending</h5>
<p>If all this is done, it&#8217;s also worthwhile adding a stylesheet to the Visual Editor that reflects the site&#8217;s styles. or otherwise helps with visualising all this.</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">add_editor_style<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>in functions.php and then a stylesheet called &#8216;editor-style.css&#8217; is all it takes.</p>
<p>Also, while all this was for some specific tasks (namely cleaning up the visual editor menu, adding two new buttons, and finding a way to add a div for columns), the methods apply to pretty much anything that could require additional markup of some kind. And while there are plugins that do some of this, it&#8217;s much more fun to write my own code.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/some-ways-to-customise-the-wordpress-visual-editor-and-html-editor/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>An intricate custom menu with WPAlchemy</title>
		<link>http://thingswithbits.info/news/an-intricate-custom-menu-with-wpalchemy/</link>
		<comments>http://thingswithbits.info/news/an-intricate-custom-menu-with-wpalchemy/#comments</comments>
		<pubDate>Sat, 18 Jun 2011 17:04:44 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[Custom Post Types]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Meta Boxes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp-admin]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=263</guid>
		<description><![CDATA[The last few days I&#8217;ve been working on a site for Dasniya Sommer. Her current site – one of the first I made as a freelancer in early-2009 – is all hand-coded, static HTML, and we&#8217;ve been talking for a while about transferring it into WordPress. This is not so straightforward, as her site exists [...]]]></description>
			<content:encoded><![CDATA[<p>The last few days I&#8217;ve been working on a site for <a href="http://dasniyasommer.de" target="_blank">Dasniya Sommer</a>. Her current site – one of the first I made as a freelancer in early-2009 – is all hand-coded, static HTML, and we&#8217;ve been talking for a while about transferring it into WordPress.</p>
<p>This is not so straightforward, as her site exists all on one page, sliding around like a giant map seen through the small window of a browser. Also there are many technical issues: multiple menu structures, back buttons, URL paths that don&#8217;t function very well at the moment; and things she&#8217;d like to have more control over: drag-to-rearrange page order, easy adding of different kinds of content (video, images, texts), easy multilingual possibilities …</p>
<p>One of the main issues was how to have a per-page specific navigation menu. This is not so difficult if the content exists on separate pages; there&#8217;s a lot of option, from <a href="http://codex.wordpress.org/Function_Reference/wp_nav_menu" target="_blank">wp nav_menu</a> to using Wigets and dynamic sidebars. For some sections I used the former, building specific menus for the index and sub-indexs, but for individual pages, all sitting on a single vast page and requiring all their links to be anchors going to somewhere else on the overall site, there wasn&#8217;t a simple method.</p>
<p>I thought about making unique nav_menu menus and then calling them using a custom field which would add the menu name to the function that displays the menus, but there were some obvious problems with this. First, she would have to leave the page she was writing in to make the menu, then go back to that page and add the menu name. Second, with pages and menus being separate, it would be difficult to keep track of what went where and the possibility of a hundred orphan menus that should be deleted if only you could be sure they weren&#8217;t in use … mess.</p>
<p>So I decided on a method that&#8217;s not quite elegant (I really wanted to integrate nav_menus directly into a page as a custom field, and have the created menu only appear on that page in wp_admin), but works quite well, using <a href="http://www.farinspace.com/wpalchemy-metabox/" target="_blank">WPAlchemy</a> again and some rather effective PHP.</p>
<p>The idea is simple:</p>
<ol>
<li>Have a custom field on every page</li>
<li>Have checkboxes for all the main navigation sections (Index, Videos, Texts and so on)</li>
<li>Have a single checkbox called &#8216;Weiter&#8217; with an additional text field to which an anchor link can be entered for going to a specific next page</li>
<li>Have a checkbox called &#8216;Zurück&#8217; which will go to the previously viewed page/area/Seite (a simple back button)</li>
<li>Be able to drag-drop rearrange them in wp_admin and have that reflected on the site</li>
<li>For nav items that are unchecked, they simply don&#8217;t appear</li>
<li>Call it from its own template part (e.g. loop-nav.menu.php) to keep the index.php clean</li>
<li>Have it work on any page or custom post type</li>
</ol>
<h5>Setting Up WPAlchemy and the Meta Boxes</h5>
<p>This is very straightforward, using the standard WPAlchemy method in functions.php:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #666666; font-style: italic;">// wpalchemy setup</span><br />
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'_TEMPLATEURL'</span><span style="color: #339933;">,</span> WP_CONTENT_URL <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">stristr</span><span style="color: #009900;">&#40;</span>TEMPLATEPATH<span style="color: #339933;">,</span> <span style="color: #0000ff;">'themes'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'customfields/wpalchemy.php'</span><span style="color: #339933;">;</span><br />
<span style="color: #b1b100;">include_once</span> <span style="color: #0000ff;">'customfields/MediaAccess.php'</span><span style="color: #339933;">;</span> <br />
<span style="color: #666666; font-style: italic;">// include css to style the custom meta boxes in wp_admin</span><br />
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; wp_enqueue_style<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'custom_meta_css'</span><span style="color: #339933;">,</span> _TEMPLATEURL <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/customfields/meta.css'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<span style="color: #000088;">$wpalchemy_media_access</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WPAlchemy_MediaAccess<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<br />
<span style="color: #666666; font-style: italic;">// metaboxes for page-specific navigation</span><br />
<span style="color: #000088;">$nav_metabox</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WPAlchemy_MetaBox<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'id'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'_custom_nav_meta'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Navigation Menu'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'template'</span> <span style="color: #339933;">=&gt;</span> TEMPLATEPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/customfields/dasniyasommer-nav-menus.php'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'types'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'page'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'custom post types'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'context'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'autosave'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'mode'</span> <span style="color: #339933;">=&gt;</span> WPALCHEMY_MODE_EXTRACT<span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #0000ff;">'prefix'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'_nav_'</span><span style="color: #339933;">,</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>This has a slightly different install path and filename than standard, and I&#8217;m using the wpalchemy_media_access class for making adding video and images easy&#8217;; it&#8217;s not necessary for the nav menus, but otherwise nothing special here.</p>
<h5>The nav-menu Custom Field</h5>
<p>This is where everything happens. Most of this is fairly straightforward also, but I&#8217;ll go through it a bit.</p>
<ol>
<li>First I make an array of all the menu items I want</li>
<li>Then I output them as checkboxes</li>
<li>I make them drag-reorderable by wrapping them in a div class=&#8221;nav-menu-item&#8221; and use jQuery .sortable to act on the class &#8220;nav-menu&#8221; that they are all contained in</li>
<li>I add a bit of CSS to make it obvious they can be dragged</li>
<li>Then I want to deal with a specific instance, the &#8216;Weiter&#8217; checkbox, to which I want to add a text field, and then treat everything else. I do this with a simple if/else statement.</li>
</ol>
<p>In general, this is the standard checkbox setup code from WPAlchemy; only the addition of the if/else statement, and css/js is different.</p>
<div class="codecolorer-container html4strict default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br />34<br />35<br />36<br />37<br />38<br />39<br />40<br />41<br />42<br />43<br />44<br />45<br />46<br />47<br />48<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;my_meta_control&quot;</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">label</span>&gt;</span>Page Navigation Menu<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">label</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav-menu&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;?php $items <span style="color: #66cc66;">=</span> array<span style="color: #66cc66;">&#40;</span> <span style="color: #ff0000;">'Weiter'</span>, <span style="color: #ff0000;">'Zurück'</span>, <span style="color: #ff0000;">'Tanz Dokumentiert'</span>, <span style="color: #ff0000;">'Bilder'</span>, <span style="color: #ff0000;">'Lesen'</span>, <span style="color: #ff0000;">'Quellen'</span>, <span style="color: #ff0000;">'Zur Zeit'</span>, <span style="color: #ff0000;">'Demnächst'</span>, <span style="color: #ff0000;">'Index'</span><span style="color: #66cc66;">&#41;</span>; ?&gt;</span><br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;?php foreach <span style="color: #66cc66;">&#40;</span>$items as $i <span style="color: #66cc66;">=</span>&gt;</span> $item): ?&gt;<br />
<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;?php $mb-&gt;</span>the_field('nav_menu');<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if ( $item == 'Weiter' ) { ?&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav-menu-item&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php $mb-&gt;</span></span>the_name(); ?&gt;[]&quot; value=&quot;<span style="color: #009900;">&lt;?php echo $item; ?&gt;</span>&quot;<span style="color: #009900;">&lt;?php $mb-&gt;</span>the_checkbox_state($item); ?&gt;/&gt; <br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;?php echo $item; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php $metabox-&gt;</span></span>the_name('url'); ?&gt;&quot; value=&quot;<span style="color: #009900;">&lt;?php $metabox-&gt;</span>the_value('url'); ?&gt;&quot;/&gt;<br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span> <span style="color: #009900;">&lt;?php</span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #66cc66;">&#125;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; else <span style="color: #66cc66;">&#123;</span></span><br />
<span style="color: #009900;">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;nav-menu-item&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">input</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;checkbox&quot;</span> <span style="color: #000066;">name</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;&lt;?php $mb-&gt;</span></span>the_name(); ?&gt;[]&quot; value=&quot;<span style="color: #009900;">&lt;?php echo $item; ?&gt;</span>&quot;<span style="color: #009900;">&lt;?php $mb-&gt;</span>the_checkbox_state($item); ?&gt;/&gt; <span style="color: #009900;">&lt;?php echo $item; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;?php <span style="color: #66cc66;">&#125;</span> endforeach; ?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">style</span>&gt;</span><br />
&nbsp; &nbsp; #_custom_nav_meta_metabox .nav-menu-item {<br />
&nbsp; &nbsp; &nbsp; &nbsp; border: 1px solid #ccc;<br />
&nbsp; &nbsp; &nbsp; &nbsp; padding: 5px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; margin: 0 10px 5px;<br />
&nbsp; &nbsp; &nbsp; &nbsp; cursor: move;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; .nav-menu-item label {<br />
&nbsp; &nbsp; &nbsp; &nbsp; margin-top: 0;<br />
&nbsp; &nbsp; &nbsp; &nbsp; padding-top: 0;<br />
&nbsp; &nbsp; }<br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; .nav-menu-item input[type='text'] {<br />
&nbsp; &nbsp; margin-top: 6px;<br />
&nbsp; &nbsp; margin-bottom: 0;<br />
&nbsp; &nbsp; }<br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">style</span>&gt;</span><br />
<br />
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">script</span> <span style="color: #000066;">type</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;text/javascript&quot;</span>&gt;</span><br />
&nbsp; &nbsp; jQuery(function($) {<br />
&nbsp; &nbsp; &nbsp; &nbsp; $('#_custom_nav_meta_metabox .nav-menu').sortable();<br />
&nbsp; &nbsp; }); <br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">script</span>&gt;</span></div></td></tr></tbody></table></div>
<p>That&#8217;s it, and it looks like this in wp_admin:</p>
<p><a href="http://thingswithbits.info/wordpress/wp-content/uploads/dasniyasommer-custom-field-nav-menu.jpg" rel="lightbox" class="images"><img src="http://thingswithbits.info/wordpress/wp-content/uploads/dasniyasommer-custom-field-nav-menu-428x404.jpg" alt="Dasniya Sommer custom field nav-menu using WPAlchemy" title="Dasniya Sommer custom field nav-menu using WPAlchemy" width="428" height="404" class="alignnone size-medium wp-image-268" /></a></p>
<p>One thing that still needs to be sorted out is that while drag-dropping works, and updates correctly on the site, in wp_admin it only shows the default structure once the page is saved. Also a possibility to add new menu items would be nice, though for Dasniya&#8217;s site it&#8217;s unnecessary.</p>
<h5>The template code</h5>
<p>Then all this needs to be outputted into the template. I&#8217;m using</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">get_template_part<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'loop'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'nav-menu'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>in the index.php template (or wherever else) and keeping the templates themselves a bit more orderly.</p>
<p>Here the process is somewhat more complex, and took me quite a while to get it all working.</p>
<ol>
<li>First set everything up using &#8216;global&#8217;</li>
<li>Making a direct call to the meta in the second line seems necessary with query_posts() and setup_postdata()</li>
<li>See if there&#8217;s any data, and if so continue</li>
<li>Begin outputting everything into a list, using foreach</li>
<li>Split off &#8216;Weiter&#8217; again, and treat it differently before outputting the rest</li>
<li>For Weiter, use the contents of the textarea for the link anchor</li>
<li>Split off &#8216;Zurück, and make the href only &#8216;#&#8217; instead of the menu item name</li>
<li>To use the nav-item titles as anchor links and classes, use PHP strtolower and preg_replace to convert them to lowercase, replace spaces with a dash, and replace umlauts with the two-letter variants</li>
<li>Use some jQuery to treat &#8216;Zurück&#8217; as a back button.</li>
</ol>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp; global $nav_metabox;<br />
&nbsp; &nbsp; $meta_nav = ($nav_metabox-&gt;the_meta());<br />
&nbsp; &nbsp; if($meta_nav) : ?&gt;<br />
<br />
&nbsp; &nbsp; &lt;p&gt; this is the list of standard links:&lt;/p&gt;<br />
&nbsp; &nbsp; &lt;ul class=&quot;nav-menu&quot;&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$meta_nav</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nav_menu'</span><span style="color: #009900;">&#93;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$nav_item</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// begin the li and a setup</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li class=&quot;nav-item&quot;&gt;&lt;a href=&quot;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// split here. if $nav_item is Weiter, then get the #link and put it in href - not using preg_replace in class as it's just 'Weiter'</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$nav_item</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Weiter'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$nav_metabox</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_value</span><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: #0000ff;">'&quot; class=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$nav_item</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: #000088;">$nav_item</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// if $nav_item is Zurück, use '#' for href – for simple back button</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$nav_item</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Zurück'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#&quot; class=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</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;">'ue'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nav_item</span><span style="color: #009900;">&#41;</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: #000088;">$nav_item</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// if it's not Weiter, then output all the other $nav_items as usual - convert to lower case, replace ' ' with '-', replace ä/ü with ae/ue to deal with umlauts</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'#'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</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: #0000ff;">'/\ü/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ae'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nav_item</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; class=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strtolower</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">array</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: #0000ff;">'/\ü/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'-'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ae'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'ue'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$nav_item</span><span style="color: #009900;">&#41;</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: #000088;">$nav_item</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #666666; font-style: italic;">// finish up and close the li</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <br />
&nbsp; &nbsp; &lt;/ul&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h5>The back button</h5>
<p>For the &#8216;Zurück&#8217; button, once it&#8217;s had its link anchor replaced with just a &#8216;#&#8217;, when clicked it should go to the previous page/section/Seite on the index page. I&#8217;m aware of the limitations of this as a &#8216;back button&#8217; method, but really felt that unless I made &#8216;Zurück&#8217; in wp_admin the same as &#8216;Weiter&#8217; there isn&#8217;t another useful option (and even that would cause different problems). So:</p>
<div class="codecolorer-container javascript default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br /></div></td><td><div class="javascript codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #006600; font-style: italic;">//go back to the previous Seite</span><br />
$<span style="color: #009900;">&#40;</span>document<span style="color: #009900;">&#41;</span>.<span style="color: #660066;">ready</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; $<span style="color: #009900;">&#40;</span><span style="color: #3366CC;">'a.zurueck'</span><span style="color: #009900;">&#41;</span>.<span style="color: #660066;">click</span><span style="color: #009900;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; parent.<span style="color: #660066;">history</span>.<span style="color: #000066;">back</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000066; font-weight: bold;">return</span> <span style="color: #003366; font-weight: bold;">false</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<h5>Finishing</h5>
<p>It feels a little unorthodox, and there were some difficulties getting it working properly. My php regex is probably atrocious, but I&#8217;ve never done such stuff before. I&#8217;m very happy with how unproblematic it was to get WPAlchemy to do this, perhaps less happy with how WordPress can be somewhat opaque in how it handles data under various circumstances, and my having to brute-force solve some issues with getting the data to show properly. </p>
<p>Overall it works very well according to what I needed, and works very well for Dasniya, though I&#8217;d still love to have found a way to do this with wp_nav_menu. I&#8217;d also love to be able to incorporate the WordPress link button into the &#8216;Weiter&#8217; Field. It looks like this (with all nav-items checked):</p>
<p><a href="http://thingswithbits.info/wordpress/wp-content/uploads/dasniyasommer-custom-field-nav-menu-site.jpg" rel="lightbox" class="images"><img src="http://thingswithbits.info/wordpress/wp-content/uploads/dasniyasommer-custom-field-nav-menu-site-428x338.jpg" alt="Dasniya Sommer custom field nav-menu Site" title="Dasniya Sommer custom field nav-menu Site" width="428" height="338" class="alignnone size-medium wp-image-269" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/an-intricate-custom-menu-with-wpalchemy/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Setting up a local development server for WordPress on my Mac</title>
		<link>http://thingswithbits.info/news/setting-up-a-local-development-server-for-wordpress-on-my-mac/</link>
		<comments>http://thingswithbits.info/news/setting-up-a-local-development-server-for-wordpress-on-my-mac/#comments</comments>
		<pubDate>Mon, 13 Jun 2011 12:36:19 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Mac]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=242</guid>
		<description><![CDATA[This has been something I&#8217;ve been planning to do for a long time and even made several attempts at it, all of which failed in various ways. Somehow at 3am last night it finally worked. Excitement! The idea is very simple: Macs come with Apache web server installed, as well as PHP. SQL needs to [...]]]></description>
			<content:encoded><![CDATA[<p>This has been something I&#8217;ve been planning to do for a long time and even made several attempts at it, all of which failed in various ways. Somehow at 3am last night it finally worked. Excitement!</p>
<p>The idea is very simple: Macs come with Apache web server installed, as well as PHP. SQL needs to be manually installed, but is simple, using a package and including a System Preferences prefpane for activation. Getting all of this running is not so complicated. Getting it working together, from a more friendly directory than somewhere buried in /Library or elsewhere, along with useable URLs instead of localhost/~myname, and running WordPress is a bit of a tussle.</p>
<p>So, first I downloaded everything: <a href="http://dev.mysql.com/downloads/mysql/" target="_blank">MySQL 5</a>, <a href="http://php.net/downloads.php" target="_blank">PHP</a>, as well as two other useful tools I&#8217;ll come back to: <a href="http://clickontyler.com/virtualhostx/" target="_blank">VirtualHostX</a>, <a href="http://www.phpmyadmin.net" target="_blank">phpMyAdmin</a>, and <a href="http://www.sequelpro.com/" target="_blank">Sequel Pro</a>.</p>
<p>One thing I didn&#8217;t download was <a href="http://www.mamp.info" target="_blank">MAMP</a>. This is a self-contained environment for running websites locally on a Mac. It includes a whole pile of stuff including Apache, PHP and MySQL. Which is why I didn&#8217;t want to use it. For those who just need a simple, click-it-works method, MAMP is probably fine. But when Apache and PHP are already installed, it seems to me a curious way to go about it. It also comes in at several hundred MB, with all its additional libraries, which I don&#8217;t like.</p>
<p>I have tried it before and got it working with one site, but found it quite limited compared to the method I&#8217;m going to attempt to describe below.</p>
<h5>MySQL</h5>
<p>MySQL installs with a package to /usr/local/mysql-(version-OS-processor e.g. 5.5.13-osx10.6-x86_64), with an additional folder also appearing in the same location called just mysql, which is an alias (or symlink) to the above installed version.</p>
<p>Along with this in /var/mysql/ is mysql.sock. This file can be elsewhere for a standard install of OS X (in /tmp), and the location in /var is I think default for OS X Server, but I found in my setting up of all this, the /var location worked.</p>
<p>This filepath may also need to be set in php.ini which is found in /etc/. If it&#8217;s not it will use the default system location. This is in several places in php.ini, and is simply like this:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #990000;">mysql</span><span style="color: #339933;">.</span>default_socket <span style="color: #339933;">=</span> <span style="color: #339933;">/</span><span style="color: #000000; font-weight: bold;">var</span><span style="color: #339933;">/</span><span style="color: #990000;">mysql</span><span style="color: #339933;">/</span><span style="color: #990000;">mysql</span><span style="color: #339933;">.</span>sock</div></td></tr></tbody></table></div>
<p>in the [MySQL] section.</p>
<p>Installing the prefpane and clicking to start MySQL Server should now give the message, &#8220;The MySQL Server Instance is <span style="color: #00ff00;">running</span>&#8220;.</p>
<h5>PHP</h5>
<p>PHP is already installed, but updating to the latest version is a good idea – especially if you&#8217;re running PHP4 instead of PHP5. Unlike MySQL, there&#8217;s no package installer, so it means messing around with Terminal and hand-editing files. The INSTALL file in the download gives all the information one could need.</p>
<p>I did this on a previous attempt to get all this running, so have forgotten the details, but some important things are in /etc/apache2/httpd.conf:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">LoadModule php5_module libexec<span style="color: #339933;">/</span>apache2<span style="color: #339933;">/</span>libphp5<span style="color: #339933;">.</span>so</div></td></tr></tbody></table></div>
<p>needs to be unchecked, as well as the AddType for PHP so .php is treated as such (and not as html).</p>
<p>Restarting Apache (in System Preferences &gt; Sharing &gt; Web Sharing) now should have all this working.</p>
<p>A simple test is to drop a file info.php into the default website directory (this can be either ~/Sites, or /Library/WebServer/Documents or whatever might have been set in httpd.conf) with the following:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #990000;">phpinfo</span><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></div></td></tr></tbody></table></div>
<p>Going to http://localhost in your browser should then throw up your php settings. If yes!, then excitement and on to installing other things. If no! then gnashing of teeth and messing around with lots of annoying things.</p>
<h5>It&#8217;s not working</h5>
<p>I had this so many times. On at least two previous occasions, I gave up because nothing would work. Of course this is in part because I&#8217;ve messed around with my system so much things are not … quite … right. But there are certain things which are problems with setting this up on OS X.</p>
<p>In short these problems (for me at least) related to one of the following:</p>
<ul>
<li>things pointing to incorrect file paths</li>
<li>incorrect permissions on files or file paths</li>
<li>incoherent weirdness</li>
</ul>
<p>The first thing to remember is if in System Preferences both Apache and MySQL say they are running, then it&#8217;s likely they are.</p>
<p>It took me a while to work out that if  &#8217;Can&#8217;t connect to Server&#8217; is what I get in your browser, then it&#8217;s probably because what I&#8217;m trying to open is not the site – this is still so when I click on the links in Sharing that are supposed to point to my website.</p>
<p>One of the most useful pieces of help comes from Apple itself, <a href="http://support.apple.com/kb/TA25038?viewlocale=en_US" target="_blank">Web Sharing &#8211; &#8220;Forbidden 403&#8243; message appears instead of website content</a>, which advises making a file in apache2/users/ called &#8216;shortname.conf&#8217; (where shortname is your User shortname) and adding the following:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #339933;">&lt;</span>Directory <span style="color: #0000ff;">&quot;/Users/shortname/Sites/&quot;</span><span style="color: #339933;">&gt;</span><br />
Options Indexes MultiViews<br />
AllowOverride None<br />
Order allow<span style="color: #339933;">,</span>deny<br />
Allow from all<br />
<span style="color: #339933;">&lt;/</span>Directory<span style="color: #339933;">&gt;</span></div></td></tr></tbody></table></div>
<p>Which seemed to fix my 403 issues. For me it seems there are permissions issues with having sites in my Home folder outside of ~/Sites, so I left them there and made an alias to that folder which goes somewhere useful, as well as in the Sidebar.</p>
<h5>VirtualHostX</h5>
<p>Once I&#8217;d gotten all this nominally working, fun could occur.</p>
<p>The problem with having all this is that it is limited to running one website unless you want to drown in further configuration. I have a few sites at the moment I want to be able to access without the turgidity of having to work on a site hosted half a world away – not just for the slowness; it&#8217;s also an issue of poor use of resources.</p>
<p><a href="http://clickontyler.com/virtualhostx/" target="_blank">VirtualHostX</a> is disconcertingly simple to use. This simple even:</p>
<ol>
<li>Add a Domain Name. I use the real site name prefixed with dev. for all this.</li>
<li>Set the Local Path. For me a specific folder in ~/Sites for each website</li>
<li>Check &#8216;Enable this Virtual Host&#8217;</li>
<li>Click &#8216;Apply Changes&#8217;</li>
<li>Restart Apache</li>
<li>Double-click the Domain name in the left column</li>
<li>Happiness.</li>
</ol>
<p>This is of course predicated on everything else already working, but once I&#8217;d got the issue of pointing to the correct directory and the 403 problem fixed, this worked first time.</p>
<p>(The developer also has an interesting post on <a href="http://clickontyler.com/blog/2011/05/experimenting-with-piracy/" target="_blank">piracy and how he tried to make a difference</a> given that over 80% of this app was running pirated or cracked serials. I was wondering myself about this, the price of the app – around €17,- – versus what it does (i.e. can I do it myself by editing the particular files needed to run different domains?). I would certainly purchase it if it was a) €10 or b) I actually had an income at the moment …)</p>
<h5>Back to SQL</h5>
<p>The usual way I deal with SQL is with phpMyAdmin. It&#8217;s ugly, unintuitive, obviously written by people who took offense at having to leave the command line in 1984, and does what it&#8217;s supposed to. Somewhere in all this last night I discovered <a href="http://www.sequelpro.com/" target="_blank">Sequel Pro</a>. It looks like a Mac app, is simple to use, can create new databases and users locally or connect to remote ones, is currently free.</p>
<p>Connecting to SQL was as simple as entering the Host as 127.0.0.1 and user as root. From there making new databases (ones with identical names as the various WordPress sites I wished to make local versions of), and duplicating users and their passwords who could connect to those databases was about as simple as using VirtualHostX.</p>
<h5>WordPress</h5>
<p>The obvious way to do this seemed to be to export the database from the live site and import it into my local install via Sequel Pro. At the same time, just copy over the entire site from remote to local. Actually this works, with several caveats.</p>
<p>Having tried this twice now, in my situation it seems best to set everything up and then import in the remote site:</p>
<ol>
<li>Create a new database with the same settings as the remote site (Host can be localhost, 127.0.0.1, or the VirtualHostX-assigned Domain Name</li>
<li>Drag a fresh install of WordPress into the site directory</li>
<li>Run the install, setting the database Host as &#8216;localhost&#8217;</li>
<li>I have to copy-paste the resulting settings as WordPress can&#8217;t seem to write to wp-config.php</li>
<li>If everything works, a fresh version of WordPress should be running.</li>
</ol>
<p>From here I copied over the remote site database and files</p>
<ol>
<li>In Sequel Pro, import the remote database over the top of the existing one you&#8217;ve just made</li>
<li>Some lines in the database table &#8216;options&#8217; will need to be edited so that the Site URL and WordPress URL point to the local site and not the remote:
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">option_name<span style="color: #339933;">:</span> siteurl<span style="color: #339933;">:</span> set to VirtualHostX Domain Name<br />
option_name<span style="color: #339933;">:</span> home<span style="color: #339933;">:</span> set to VirtualHostX Domain Name</div></td></tr></tbody></table></div>
</li>
<li>In the site folder, add the site-specific template and check this is working</li>
<li>In the site folder, add the site-specific plugins and check they are working</li>
<li>If permalinks don&#8217;t work or more &#8217;403 Forbidden&#8217; occurs, add this to the .htaccess file in the site root folder on the first line:
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">Options <span style="color: #339933;">+</span>FollowSymLinks</div></td></tr></tbody></table></div>
</li>
<li>Clean up resulting mess</li>
</ol>
<h5>Finishing Up</h5>
<p>There are still some small weirdnesses, and I&#8217;m not sure how easy it would be to go the other way, i.e. once finished in the dev site to transfer it back without too many hassles. Also certain things I do on all live sites, e.g. .htaccess stuff, ssh, various security things, caching and database plugins and so on are not really necessary on a local site, so there needs to be a slightly considered process in moving from local to remote.</p>
<p>The time saved though, from each page refresh by working locally, as well as the small environmental goodness of not using the internet half way around the world to a shared server somewhere for what should in fact always be done locally is a good reason to spend half a day getting this working.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/setting-up-a-local-development-server-for-wordpress-on-my-mac/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A mullet post shortcode</title>
		<link>http://thingswithbits.info/news/a-mullet-post-shortcode/</link>
		<comments>http://thingswithbits.info/news/a-mullet-post-shortcode/#comments</comments>
		<pubDate>Fri, 06 May 2011 11:55:49 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[functions.php]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[shortcodes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=196</guid>
		<description><![CDATA[I&#8217;m working on a site at the moment which has something of a single page portfolio layout. One of the pages / sections has the latest news. Not wanting to have the length of this section creep on, I wanted to use the famous Mullet Loop – the first post in its entirety, the remaining [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m working on a site at the moment which has something of a single page portfolio layout. One of the pages / sections has the latest news. Not wanting to have the length of this section creep on, I wanted to use the famous Mullet Loop – the first post in its entirety, the remaining however many just as post titles. Easy enough to do if I wanted to drop it into a template page but …</p>
<p>Using the WordPress code to output top-level pages into a single page doesn&#8217;t seem to want to also include the page with the news, or more accurately, its content. (ok, I probably could have used another Template page for this, but anyway …)</p>
<p>Shortcode? Yes!</p>
<p>Finding some code that would output the pages as a list was easy. Finding something <a href="http://www.rhanney.co.uk/2010/08/26/simple-recent-posts-shortcodes-for-wordpress/" target="_blank">a little more flexible</a> took a little longer. Adding in the extra get_whatever, was 5 minutes. Making a loop in the shortcode function took a bit of thinking as to where exactly the loop was looping and how to get it to do so.</p>
<p>After a an hour or so testing and generally messing about, I have this in my functions.php:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> theme_name_recent_posts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span>shortcode_atts<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'limit'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$atts</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$q</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> WP_Query<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$limit</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #000088;">$list</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;div class=&quot;recent-posts&quot;&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <br />
&nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">while</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">have_posts</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: #000088;">$q</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">the_post</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$count</span><span style="color: #339933;">++;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$count</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$list</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;post&quot;&gt;'</span> <span style="color: #339933;">.</span> get_the_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</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: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span> <span style="color: #339933;">.</span> get_the_content<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #339933;">:</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$list</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;div class=&quot;post&quot;&gt;'</span> <span style="color: #339933;">.</span> get_the_date<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</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: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> get_the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; wp_reset_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><br />
&nbsp;<br />
&nbsp; &nbsp; <span style="color: #b1b100;">return</span> <span style="color: #000088;">$list</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/div&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
&nbsp;<br />
add_shortcode<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'recent-posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'theme_name_recent_posts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></div></td></tr></tbody></table></div>
<p>Which I can then add to any page I want with, setting the number of pages with &#8216;limit&#8217;:</p>
<div class="codecolorer-container html4strict default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">[recent-posts limit=&quot;4&quot;]</div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/a-mullet-post-shortcode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CSS and lang attributes, or, Multilingual Styling</title>
		<link>http://thingswithbits.info/news/css-and-lang-attributes-or-multilingual-styling/</link>
		<comments>http://thingswithbits.info/news/css-and-lang-attributes-or-multilingual-styling/#comments</comments>
		<pubDate>Mon, 25 Apr 2011 16:30:13 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Multilingual]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=187</guid>
		<description><![CDATA[The last week I&#8217;ve been uploading video to my other website, francesdath.info, which I&#8217;ve become much more engaged with since dumping into WordPress. I also began thinking about making the site multilingual, as I&#8217;ve worked in China for some projects and now live in Berlin. The latter being of certain importance to me because I [...]]]></description>
			<content:encoded><![CDATA[<p>The last week I&#8217;ve been uploading video to my other website, <a href="http://francesdath.info" target="_blank">francesdath.info</a>, which I&#8217;ve become much more engaged with since dumping into WordPress.</p>
<p>I also began thinking about making the site multilingual, as I&#8217;ve worked in China for some projects and now live in Berlin. The latter being of certain importance to me because I hold a somewhat traditional idea that it&#8217;s important to learn the language of the country I live in, and that one can never really be part of a place until able to converse.</p>
<p>Having done a couple of sites using <a href="http://www.qianqin.de/qtranslate/" target="_blank">qTranslate</a>, I felt uncomplicated about adding this into my site. Despite some shortcomings in both WordPress and qTranslate, it&#8217;s really the best plugin for what should be native in WordPress, and anyway, none of the shortcomings I&#8217;ve fell over can&#8217;t be fixed with something in either the template or functions.php.</p>
<p>It all took about 15 minutes to install and set up. Being a fan of the two-letter language codes, and wanting to keep the usual minimalism of the site, I copy-pasted the following into my functions.php, which I also used on sumiyang.com (I&#8217;m not sure where I found this originally, i think <a href="http://www.qianqin.de/qtranslate/forum/viewtopic.php?f=3&#038;t=1476" target="_blank">maybe here</a>):</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #000000; font-weight: bold;">function</span> curPageURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000088;">$pageURL</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;HTTPS&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">&quot;on&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$pageURL</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&#125;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #000088;">$pageURL</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">&quot;://&quot;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_PORT&quot;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">&quot;80&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$pageURL</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_NAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">&quot;:&quot;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_PORT&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REQUEST_URI&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span> <br />
&nbsp; &nbsp; <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #000088;">$pageURL</span> <span style="color: #339933;">.=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;SERVER_NAME&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">.</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">&quot;REQUEST_URI&quot;</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp;<span style="color: #009900;">&#125;</span><br />
<span style="color: #b1b100;">return</span> <span style="color: #000088;">$pageURL</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span><br />
<br />
<span style="color: #000000; font-weight: bold;">function</span> langlist <span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> qtrans_convertURL<span style="color: #009900;">&#40;</span>curPageURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'en'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;en&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> qtrans_convertURL<span style="color: #009900;">&#40;</span>curPageURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'de'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;de&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp; &nbsp; <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;li&gt;&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> qtrans_convertURL<span style="color: #009900;">&#40;</span>curPageURL<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'zh'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;zh&lt;/a&gt;&lt;/li&gt;'</span><span style="color: #339933;">;</span><br />
&nbsp; &nbsp;<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">;</span><br />
<span style="color: #009900;">&#125;</span></div></td></tr></tbody></table></div>
<p>Then in the header.php, I just added:</p>
<div class="codecolorer-container php default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br /></div></td><td><div class="php codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&lt;div id=&quot;languages&quot;&gt;<br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">&lt;?php</span> langlist<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><br />
&lt;/div&gt;</div></td></tr></tbody></table></div>
<p>Followed by some very minimal css.</p>
<p>And then I ran into a problem.</p>
<p>I was using the pseudoclass :after with content=&#8221;blah&#8221; to add some text in the menu – all the white background text after the links. It was an appropriate solution at the time, but oh did it mess with my 15 minutes site multilingualising, because while you can throw qTranslate shortcodes around pretty much anywhere, they don&#8217;t work in a style sheet.</p>
<p>I tried – of course – jQuery. Find some text, replace it with some extra text, some spans and a bit of CSS and identicalness would ensue. It didn&#8217;t. I think it might be because of how I have WordPress set up to add useful classes to the wp_nav_menu, but in any case, the changes weren&#8217;t made no matter what I tried.</p>
<p>So I started wondering I could use media queries to target different style sheets for different languages – fully aware of the pain of that path (multiple stylesheets to maintain), as well as the overkill, just needing a few lines in multiple languages. While media queries is very powerful and brilliant for so many reasons, it doesn&#8217;t do languages.</p>
<p>And then…</p>
<p>This is the most brilliant thing I&#8217;ve found in CSS in ages:</p>
<p><a href="http://www.w3.org/International/questions/qa-css-lang.en.php" target="_blank">Styling using language attributes</a></p>
<p>I couldn&#8217;t believe it. You can style elements in CSS based on the html language declaration. Even better, there&#8217;s a pseudoclass, :lang(). Brilliant! I had to run around for a bit until I calmed down.</p>
<p>Then there was the anxious moment, would it work with concatenating pseudoclasses? </p>
<p>Yes!</p>
<div class="codecolorer-container css default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#access</span> li<span style="color: #6666ff;">.about</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot; Frances d'Ath&quot;</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#access</span> li<span style="color: #6666ff;">.about</span><span style="color: #00AA00;">:</span>lang<span style="color: #00AA00;">&#40;</span>de<span style="color: #00AA00;">&#41;</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;Frau d'Ath&quot;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#access</span> li<span style="color: #6666ff;">.about</span><span style="color: #00AA00;">:</span>lang<span style="color: #00AA00;">&#40;</span>zh<span style="color: #00AA00;">&#41;</span><span style="color: #3333ff;">:after </span><span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">content</span><span style="color: #00AA00;">:</span> <span style="color: #ff0000;">&quot;方希石&quot;</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>Nice!</p>
<p>You can see this on <a href="http://francesdath.info" target="_blank">francesdath.info</a>, using the language buttons in the top right.</p>
<p>In immediate hindsight, it&#8217;s obvious there would be something like this. It can solve a lot of problems simply: different fonts for different languages (with @font-face!) is the first that comes to mind. Also, lack of support in certain nameless browsers will ruin it for the rest of us. But I&#8217;m just completely thrilled at what an elegant and smart method this is. (Now I just have to translate sixteen pages into two new languages.)</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/css-and-lang-attributes-or-multilingual-styling/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>HTML5 video sadness and disappointment</title>
		<link>http://thingswithbits.info/news/html5-video-sadness-and-disappointment/</link>
		<comments>http://thingswithbits.info/news/html5-video-sadness-and-disappointment/#comments</comments>
		<pubDate>Mon, 04 Apr 2011 13:21:19 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[HTML]]></category>
		<category><![CDATA[Internet]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=179</guid>
		<description><![CDATA[With Firefox 4 arriving, I discovered some quirks in how it dealt with video using my default Flowplayer setup (which I eventually traced to some stuff in htaccess), and feeling frustrated with the difficulty of Flash video, I decided – after months of on-off reading on HTML5 video to throw myself into it. I ended [...]]]></description>
			<content:encoded><![CDATA[<p>With Firefox 4 arriving, I discovered some quirks in how it dealt with video using my default Flowplayer setup (which I eventually traced to some stuff in htaccess), and feeling frustrated with the difficulty of Flash video, I decided – after months of on-off reading on HTML5 video to throw myself into it. I ended up deciding to unthrow myself.</p>
<p>I&#8217;ve been using Flowplayer for a couple of years now. It&#8217;s powerful, configurable, plays video really well, can do all sorts of fancy pseudostreaming and bandwidth detection (if your server is set up for it), and it runs on Flash. Even still, it will work on iPhone and iPad if you use the correct plugin. Why change? Well partly because of a curiosity about HTML5 video, and partly because of Flowplayer&#8217;s limitations.</p>
<p>I&#8217;d done a bit of research before, and decided to use VideoJS, as it has some nice features, and for older browsers falls back to Flash using Flowplayer, so I could just wrap the fallback code around my existing video code and happiness should ensue.</p>
<p>And happiness did, for a moment.</p>
<p>But then …</p>
<p>This is more-or-less several paragraphs about my frustration with the rubbish state of video in browsers. When I made my first website (in Flash) just before going to China the first time, there was no video in Flash and little beyond QuickTime-embedded . A hacky/brilliant workaround using JavaScript to strip the chrome off a QuickTime movie, overlay it in the page, and communicate with it from the Flash controls was as good as it got. And really, eight years later, it&#8217;s not much better.</p>
<p>Think about putting an image into a web page. Use the img tag. Almost any file format will work without a second thought in all browsers, so then you can get onto the fun stuff, galleries, animation … but having to spend most of your effort just on dealing with shoddy browser support for a picture does not play a part.</p>
<p>So why is video so difficult?</p>
<p>Once I&#8217;d got my head around the setup of the video tag, and understood generally how it worked, tested in a few browsers and felt quite good, I started coming up against multiple problems. Broadly these are in three areas: dealing with the different handling of different browsers, dealing with getting the video ready for different browsers, and having a workflow that doesn&#8217;t make me cry.</p>
<p>The last one is crucial. I use WordPress because I want to be able to hand over the entering of content to the person whose website it is. I don&#8217;t want to tell her, &#8220;download ffmpeg, install via command line, and then to compress your video, enter (string of gibberish)&#8221;. If I have to stop to understand how something works, what&#8217;s it going to be like for people who just want to get their video up?</p>
<p>Unlike getting video ready for Flowplayer, which is simply encoding to h264 and can be done with minimal hassle with something like Handbrake or even QuickTime 7, HTML5 video needs it in three different formats, the latter two – WebM and OGG – unless you want to get into aforementioned command line, have few options on a Mac.</p>
<p>I tried installing the two codecs for Quicktime (WebM and Xiph) and found the results to be poor. Blocky video, mediocre colour fidelity, softness and more (or rather less), all which point to the most significant problem with HTML5 video: WebM and OGG are nowhere near good enough for web video.</p>
<p>I also tried Miro Video Converter, which unlike all the others (bar Permute) does all the necessary formats. Using ffmpeg in the back, its drag-drop efficiency is commendable, and were it not for the inability to adjust the defaults would be one to consider using, but again, the quality simply wasn&#8217;t good enough. (I should mention, the video source for the tests was a variety including at best HD and at worst f4v.) I settled on Permute, which is one step up, and gives a modicum of configuration, but still the poor rendering of WebM and OGG can&#8217;t be ignored.</p>
<p>If this wasn&#8217;t bad enough, and it was admittedly workable – I could see how to put together a workflow for people that wouldn&#8217;t horrify them, that got them from edited video to the three files, uploaded and into WordPress using metaboxes, all not beyond an average internet user&#8217;s capabilities – it could have at least been offset by the browsers doing something useful like respecting the &#8216;preload&#8217; attribute.</p>
<p>preload is the killer for HTML5 video and the single fundamental reason why it&#8217;s unworkable and will remain so until browser vendors stop pretending it&#8217;s &#8220;1998 browser war!&#8221;</p>
<p>There are three possible preload options: none, metadata (loads the first frame and makes sure it can play whatever it is), and auto – which (seems to) loads the video in the background once a page is finished loading. The latter is useful for a page in which all there is is a video to watch, but for a site with say five videos on one page, each of around 80-100mb, with browsers who think preload=&#8221;none&#8221; is something to ignore, it&#8217;s horrific.</p>
<p>The only workaround I saw was a truly ugly JavaScript hack, replacing the splash image with the video element when clicked. I cringed. Even thinking along the same lines, using jQuery to load an external file with the video code is just stupid.</p>
<p>Other things that annoyed me in no particular order: when clicking another video or link, the current video keeps playing; no easy possibility for html over the video or splash image; no simple support for bandwidth detection or SD/HD options … I could go on, but I really did cry with frustration at what should be so simple.</p>
<p>It&#8217;s so disappointing that in 2011 browsers are still pathetic at handling video. It makes it horrible for people making websites as well as people who just want to add video to their own sites and don&#8217;t want to be hobbled by the limitations of YouTube or Vimeo. And it&#8217;s insulting for all of us with Chrome and Firefox pretending WebM and OGG are acceptable and pulling the &#8216;open&#8217; and &#8216;free&#8217; trope against h.264.</p>
<p>I want video to work just like img. If it doesn&#8217;t, there is no point in using anything other than Flash.</p>
<p>For the moment, I stay with Flowplayer and h.264 with Flash. It&#8217;s not perfect, and has its own frustrations, but at least it works.</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/html5-video-sadness-and-disappointment/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>A sticky footer pretending to be a link</title>
		<link>http://thingswithbits.info/news/a-sticky-footer-pretending-to-be-a-link/</link>
		<comments>http://thingswithbits.info/news/a-sticky-footer-pretending-to-be-a-link/#comments</comments>
		<pubDate>Wed, 23 Mar 2011 18:05:27 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[Meta Boxes]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=166</guid>
		<description><![CDATA[Finishing up francesdath.info, I noticed there was a lack of credits for the background images. I didn&#8217;t want to have something obvious interrupting every page, but equally putting something in the alt tag, while adequate for those who poke around, wasn&#8217;t quite in the spirit of attribution. I had an idea for a question mark [...]]]></description>
			<content:encoded><![CDATA[<p>Finishing up <a href="http://francesdath.info" target="_blank">francesdath.info</a>, I noticed there was a lack of credits for the background images. I didn&#8217;t want to have something obvious interrupting every page, but equally putting something in the alt tag, while adequate for those who poke around, wasn&#8217;t quite in the spirit of attribution.</p>
<p>I had an idea for a question mark in the bottom right corner, unobtrusive, yet also noticeable, matching the formatting for links throughout the site, that when hovered over would show a box with details of performance, performers in the photograph, and photographer&#8217;s name.</p>
<p>I tried a couple of options, first looking at tooltips, but the formatting, even with jQuery, wasn&#8217;t so simple. I also didn&#8217;t really want to go to jQuery anyway. What I wanted was to create a metabox with the three fields, which would spit the content into whatever markup could be most agreeable to being styled.</p>
<p>The metabox part was easy, about 30 minutes sticking it all together and testing. The styling though…</p>
<p>Once I&#8217;d discarded the tooltips approach, the next method seemed to be the the <a href="http://meyerweb.com/eric/css/edge/popups/demo.html" target="_blank">Eric Meyer pure CSS popups</a> method, sticking a span inside a link and display: none until hover and then showing it. Ok for single lines of text that don&#8217;t need additional styling, but for what I wanted, each item on a separate line, it didn&#8217;t work.</p>
<p>Perhaps I should have read around more, but it occurred to me that a div can handle the :hover pseudo element just as well as a link can, so then I could have one div that I&#8217;d attach that to, and another div inside that which would be displayed or not, opening up all manner of possibilities, like this:</p>
<div class="codecolorer-container html4strict default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br /></div></td><td><div class="html4strict codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;credits&quot;</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;details&quot;</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>performance: <span style="color: #009900;">&lt;?php global $credits_metabox; $credits_metabox-&gt;</span>the_value('credits_performance'); ?&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>performers (l-r): <span style="color: #009900;">&lt;?php global $credits_metabox; $credits_metabox-&gt;</span>the_value('credits_performers'); ?&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>photographer: <span style="color: #009900;">&lt;?php global $credits_metabox; $credits_metabox-&gt;</span>the_value('credits_photographer'); ?&gt;<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><br />
&nbsp; &nbsp; <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">span</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;question&quot;</span>&gt;</span>?<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">span</span>&gt;</span><br />
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span><span style="color: #808080; font-style: italic;">&lt;!-- #credits --&gt;</span></div></td></tr></tbody></table></div>
<div class="codecolorer-container css default" style="border:1px solid #9F9F9F;width:435px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br /></div></td><td><div class="css codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap"><span style="color: #cc00cc;">#credits</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">fixed</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">bottom</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">0</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#credits</span> span<span style="color: #6666ff;">.question</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#54cbff</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">2px</span> <span style="color: #933;">1px</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">cursor</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">pointer</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#credits</span> div<span style="color: #6666ff;">.details</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#credits</span><span style="color: #3333ff;">:hover </span>div<span style="color: #6666ff;">.details</span> <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">block</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">position</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">relative</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">z-index</span><span style="color: #00AA00;">:</span> <span style="color: #cc66cc;">100</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">background</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#000</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">13px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span><br />
<br />
<span style="color: #cc00cc;">#credits</span><span style="color: #3333ff;">:hover </span>div<span style="color: #6666ff;">.details</span> p <span style="color: #00AA00;">&#123;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">padding</span><span style="color: #00AA00;">:</span> <span style="color: #933;">1px</span> <span style="color: #933;">2px</span> <span style="color: #933;">2px</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span><br />
&nbsp; &nbsp; <span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #000000; font-weight: bold;">right</span><span style="color: #00AA00;">;</span><br />
<span style="color: #00AA00;">&#125;</span></div></td></tr></tbody></table></div>
<p>Besides the miscellaneous styling, what&#8217;s important is the #credits styling to fix it in the bottom right corner, and the display: none of .details, as well as the display: block and styling with #credits:hover. the cursor: pointer helps in that it changes the default arrow to a standard link pointer; a slight visual cue. I&#8217;m sure I could have written it more concisely and neatly, and additionally I could add a CSS3 fadein transition, but I had to get to rehearsal.</p>
<p><a href="http://thingswithbits.info/wordpress/wp-content/uploads/css-tooltip-div-hide.jpg" rel="lightbox"><img src="http://thingswithbits.info/wordpress/wp-content/uploads/css-tooltip-div-hide-428x247.jpg" alt="CSS Tooltip Div Hidden" title="CSS Tooltip Div Hidden" width="428" height="247" class="alignnone size-medium wp-image-169" /></a></p>
<p><a href="http://thingswithbits.info/wordpress/wp-content/uploads/css-tooltip-div-show.jpg" rel="lightbox"><img src="http://thingswithbits.info/wordpress/wp-content/uploads/css-tooltip-div-show-428x247.jpg" alt="CSS Tooltip Div hover Shown" title="CSS Tooltip Div hover Shown" width="428" height="247" class="alignnone size-medium wp-image-170" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/a-sticky-footer-pretending-to-be-a-link/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>2011.touchandplay.org</title>
		<link>http://thingswithbits.info/news/2011-touchandplay-org/</link>
		<comments>http://thingswithbits.info/news/2011-touchandplay-org/#comments</comments>
		<pubDate>Sat, 19 Mar 2011 13:08:09 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[functions.php]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugins]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Website Updates]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=158</guid>
		<description><![CDATA[Today the 2011.touchandplay.org Festival site went live. After last year&#8217;s festival site, I organised the transferral of the site, formerly at a .eu domain, to it&#8217;s own sub-domain, now at 2010.touchandplay.org, and separating off touchandplay.org onto its own, which is my next project. The festival last year was in Berlin, and this year moves to [...]]]></description>
			<content:encoded><![CDATA[<p>Today the <a href="http://2011.touchandplay.org/" target="_blank">2011.touchandplay.org</a> Festival site went live. After last year&#8217;s festival site, I organised the transferral of the site, formerly at a .eu domain, to it&#8217;s own sub-domain, now at <a href="http://2010.touchandplay.org/" target="_blank">2010.touchandplay.org</a>, and separating off <a href="http://touchandplay.org" target="_blank">touchandplay.org</a> onto its own, which is my next project.</p>
<p>The festival last year was in Berlin, and this year moves to Cardona, Spain, near Barcelona. I wanted to keep aspects of the design, as well as much of the structure, as it is not so small, with over a hundred pages. In the last year also, I&#8217;ve spent so much time in WordPress that organising all the templates with conditional tags, shortcodes and functions.php was a fairly simple process. Coming straight from Brussels though – and not having a laptop for last week as the deadline came up, gave me a few 5am finishes.</p>
<p>So, first in Photoshop, keeping the splattery title, and creating a much simpler background – it&#8217;s not often I do sites with light typography on a dark background. The background images themselves are of the venue, currently being renovated, with the architectural plans laid over the top. Keeping the content areas legible then was very important.</p>
<p>Some of the code I&#8217;ve been writing in the previous weeks and months turned up here, including the shortcode for adding Flowplayer video, the very simple PHP background image rotator, other bits and pieces including the use of tags on pages for different workshop types, coupled with a conditional statement to only show the tags section on workshops with tags.</p>
<p>Still little things to fix up, but nice for all of us to see it alive on a sunny Spring Equinox in Berlin.</p>
<p><a rel="lightbox" href="http://thingswithbits.info/wordpress/wp-content/uploads/2011-touch-and-play-festival.jpg"><img class="alignnone size-medium wp-image-159" title="2011 Touch&amp;Play Festival" src="http://thingswithbits.info/wordpress/wp-content/uploads/2011-touch-and-play-festival-428x295.jpg" alt="2011 Touch&amp;Play Festival" width="428" height="295" /></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/2011-touchandplay-org/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>francesdath.info</title>
		<link>http://thingswithbits.info/news/francesdath-info/</link>
		<comments>http://thingswithbits.info/news/francesdath-info/#comments</comments>
		<pubDate>Fri, 11 Mar 2011 15:17:21 +0000</pubDate>
		<dc:creator>frances</dc:creator>
				<category><![CDATA[CSS]]></category>
		<category><![CDATA[Design]]></category>
		<category><![CDATA[HTML]]></category>
		<category><![CDATA[jQuery]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Typography]]></category>
		<category><![CDATA[Video]]></category>
		<category><![CDATA[Web Design]]></category>
		<category><![CDATA[Website Updates]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://thingswithbits.info/?p=150</guid>
		<description><![CDATA[The last few days in my spare time around other projects, cycling around Berlin, midnight yoga, weekend yoga &#38; shibari workshops and other stuff, I&#8217;ve been updating my venerable performance website, francesdath.info. Almost ten years old, but with a name change half-way when zeroballet.info was lost, it&#8217;s been through several incarnations. The original was in [...]]]></description>
			<content:encoded><![CDATA[<p>The last few days in my spare time around other projects, cycling around Berlin, midnight yoga, weekend yoga &amp; shibari workshops and other stuff, I&#8217;ve been updating my venerable performance website, <a href="http://francesdath.info" target="_blank">francesdath.info</a>. Almost ten years old, but with a name change half-way when zeroballet.info was lost, it&#8217;s been through several incarnations.</p>
<p>The original was in Flash, when people were all making beautiful sites using this, and <a href="http://www.miniml.com/" target="_blank">miniml</a> was the choice of font. Then, when the split occurred, and <a href="http://supernaut.info" target="_blank">supernaut.info</a> went off on her own (first into Movable Type, then not so long ago into WordPress), or some time after, I became frustrated with how difficult it was to add new content, and so threw together a static HTML design in an afternoon.</p>
<p>That one lasted for a long time with few changes, though the last year I was always thinking of replacing the monospaced font with <a href="http://www.ms-studio.com/FontSales/anonymouspro.html" target="_blank">Anonymous Pro</a> and sticking it all into WordPress.</p>
<p>WordPress did seem a little excessive for what is a mostly unchanging website, several pages with little content and one with (I always planned but never added) a lot of video. Then there was the issue of recreating the video playlist in a WordPress page. Some pondering, and <a title="Flowplayer Playlists and WPAlchemy Meta Boxes" href="http://thingswithbits.info/2011/03/flowplayer-playlists-and-wpalchemy-meta-boxes/" target="_blank">I solved that</a>, and all the other stuff, menus, background images, typography, proper semantic-ish structure, all the usual plugins I add that give a modicum of functionality, all fell together.</p>
<p>The 404 page is rather special too.</p>
<p><a rel="lightbox" href="http://thingswithbits.info/?attachment_id=154"><img class="alignnone size-medium wp-image-154" title="francesdath.info" src="http://thingswithbits.info/wordpress/wp-content/uploads/frances-dath-info-428x298.jpg" alt="francesdath.info" width="428" height="298" /></a></p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://thingswithbits.info/news/francesdath-info/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

