<?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>Andrew Vayanis &#187; Wordpress</title>
	<atom:link href="http://www.vayanis.com/tag/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.vayanis.com</link>
	<description>... a little piece of my mind.</description>
	<lastBuildDate>Wed, 02 Feb 2011 05:05:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Command Center version 0.1</title>
		<link>http://www.vayanis.com/2007/08/14/command-center-version-01/</link>
		<comments>http://www.vayanis.com/2007/08/14/command-center-version-01/#comments</comments>
		<pubDate>Tue, 14 Aug 2007 20:06:44 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/08/14/command-center-version-01/</guid>
		<description><![CDATA[After another week of configuring this site, I have found another gap in functionality that I would like to have for my WordPress installation. Namely, the ability to integrate or centralize my site&#8217;s external services. For this reason, I have started my first WordPress plugin, Command Center, as a way to give myself and of [...]]]></description>
			<content:encoded><![CDATA[<p>After another week of configuring this site, I have found another gap in functionality that I would like to have for my WordPress installation.  Namely, the ability to integrate or centralize my site&#8217;s external services.  For this reason, I have started my first WordPress plugin, <a href="http://www.vayanis.com/wp-command-center/" title="Command Center homepage">Command Center</a>, as a way to give myself and of course, anyone else who shares this need, a way to integrate certain external resources into their own Wordpess control panel.  This plugin is still far from being mature, but I think it is at least stable and usable as a way to store, access, and manage a list of links.</p>
<p><span id="more-22"></span></p>
<p>As always, I am still busy with my own job, family, and other personal projects, but I will make sure to update and enchance the plugin&#8217;s functionality regularly.</p>
<p>Feel free to visit  the <a href="http://www.vayanis.com/wp-command-center/" title="Command Center homepage">Command Center Homepage</a> for more information and/or updates.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/08/14/command-center-version-01/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress 2.2&#039;s &#8211; Link Widget Validation Errors</title>
		<link>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/</link>
		<comments>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/#comments</comments>
		<pubDate>Thu, 09 Aug 2007 05:24:01 +0000</pubDate>
		<dc:creator>Andrew Vayanis</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[XHTML/CSS]]></category>

		<guid isPermaLink="false">http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/</guid>
		<description><![CDATA[WordPress has really come a long way since I first started using it back when it was version 1.0. It now has a nice clean admin interface (although I am currently using the tiger style admin), a clean and simple installation script, and my new favorites, dynamic sidebars and widgets. However, I noticed that the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.wordpress.org" title="Wordpress homepage">WordPress</a> has really come a long way since I first started using it back when it was version 1.0.  It now has a nice clean admin interface (although I am currently using the <a href="http://orderedlist.com/wordpress-plugins/wp-tiger-administration/" title="Tiger Style Admin">tiger style admin</a>), a clean and simple installation script, and my new favorites, dynamic sidebars and widgets.  However, I noticed that the default links widget creates invalid XHTML markup.  After a few minutes of looking through the XHTML and widgets.php file, I realized that the culprit was in fact a core wordpress bug.  Currently, wordpress creates widgets with the following code:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #0000ff;">'before_widget'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'&lt;li id=&quot;%1$s&quot; class=&quot;widget %2$s&quot;&gt;'</span><span style="color: #339933;">,</span></pre></div></div>

<p><span id="more-20"></span></p>
<p>This has the nasty effect of creating widget wrappers according to their widget name due to the &#8220;%1$s&#8221;, which isn&#8217;t a deal until you actually have multiple instances of the same widget; in my case, the links widget.  Having figured out the problem, I began searching for solutions online and stumbled upon the actual WordPress bug report in <a href="http://trac.wordpress.org/ticket/4287" title="wordpress bug report: 4287">trac</a>.  The proposed solution was to add the following line of code before the call to wp_list_bookmarks() in wp_widget_links():</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$before_widget</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/id=&quot;[^&quot;]*&quot;/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;%id&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$before_widget</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Unfortunately, this solution wasn&#8217;t good enough for me because I didn&#8217;t want to have to remember this in case the next WordPress release didn&#8217;t fix the bug.  So, after some quick thinking I came up with the following bit of code that can be added to any theme&#8217;s function.php file (I think, I am a bit new to WordPress widgets, in fact, this will be my first).</p>
<p>Edit: This code is actually the exact copy of the widget_links code that ships with wordpress in the widget.php file.  All I did was add the previous fix and moved it into functions.php to create a custom widget.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> widget_my_links<span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_db_version</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">extract</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$args</span><span style="color: #339933;">,</span> EXTR_SKIP<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_db_version</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">3582</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">// This ONLY works with li/h2 sidebars.</span>
        get_links_list<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000088;">$before_widget</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'/id=&quot;[^&quot;]*&quot;/'</span><span style="color: #339933;">,</span><span style="color: #0000ff;">'id=&quot;%id&quot;'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$before_widget</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        wp_list_bookmarks<span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'title_before'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$before_title</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'title_after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$after_title</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'category_before'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$before_widget</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'category_after'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$after_widget</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'show_images'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'linkcat widget'</span>
        <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'register_sidebar_widget'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    register_sidebar_widget<span style="color: #009900;">&#40;</span>__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'My Links'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'widget_my_links'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This should add a custom widget called &#8216;My Links&#8217; when you view the Presentation->Widgets menu.  Replace your current Links Widget with this one, and you should be set to go.  No more invalid markup, at least not from the links widget.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.vayanis.com/2007/08/09/wordpress-22s-link-widget-validation-errors/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
	</channel>
</rss>

