<?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>WhyPad &#187; WordPress Plugins</title>
	<atom:link href="http://www.whypad.com/category/wordpress-plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.whypad.com</link>
	<description>Tips, tricks, and hacks for life and tech...</description>
	<lastBuildDate>Tue, 06 Jul 2010 15:21:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>WordPress: Add Your Plugin&#8217;s Settings Link to Admin Plugins Page</title>
		<link>http://www.whypad.com/posts/wordpress-add-settings-link-to-plugins-page/785/</link>
		<comments>http://www.whypad.com/posts/wordpress-add-settings-link-to-plugins-page/785/#comments</comments>
		<pubDate>Wed, 24 Mar 2010 04:20:28 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=785</guid>
		<description><![CDATA[Hello, WordPress plugin authors!  I&#8217;ve been envious of that little &#8220;Settings&#8221; link on the Plugins page in the Admin on several of the plugins I use on my blogs.  I wanted one for my own PhotoSmash plugin! My first stop, Google, yielded no fruit, but persistence paid off.  So, thanks to GD-Star Ratings and Shadowbox-JS, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.whypad.com/posts/wordpress-add-settings-link-to-plugins-page/785/"><img class="alignleft size-thumbnail wp-image-715" title="wp" src="http://www.whypad.com/wp-content/uploads/wp-150x150.png" alt="" width="150" height="150" /></a>Hello, WordPress plugin authors!  I&#8217;ve been envious of that little &#8220;Settings&#8221; link on the Plugins page in the Admin on several of the plugins I use on my blogs.  I wanted one for my own PhotoSmash plugin!</p>
<p><span id="more-785"></span></p>
<p>My first stop, Google, yielded no fruit, but persistence paid off.  So, thanks to GD-Star Ratings and Shadowbox-JS, I finally figured it out!</p>
<p>And now, for your coding pleasure, here&#8217;s the step-by-step:</p>
<h2>Steps for Showing Settings Link</h2>
<p>1. Add a function that injects your link into the links array.  The array_unshift adds your link to the front of the array.  The $this_plugin wizardry is determining whether this instance of the filter is being called for your plugin or another one.  You only want to add the link to your plugin <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .  Here&#8217;s the code:</p>
<pre class="brush: php;">

/**
 * Add Settings link to plugins - code from GD Star Ratings
 */
 function add_settings_link($links, $file) {
static $this_plugin;
if (!$this_plugin) $this_plugin = plugin_basename(__FILE__);

if ($file == $this_plugin){
$settings_link = '&lt;a href=&quot;admin.php?page=bwb-photosmash.php&quot;&gt;'.__(&quot;Settings&quot;, &quot;photosmash-galleries&quot;).'&lt;/a&gt;';
 array_unshift($links, $settings_link);
}
return $links;
 }
</pre>
<p>Of course, you&#8217;ll need to change the page link as appropriate.  The easiest way to get that is to go to your plugin&#8217;s settings page and copy it from the URL.  You want everything after the last forward slash &#8220;/&#8221;. Screenshot!</p>
<p><a href="http://www.whypad.com/wp-content/uploads/plugin-url.png"><img class="aligncenter size-full wp-image-786" title="plugin-url" src="http://www.whypad.com/wp-content/uploads/plugin-url.png" alt="" width="480" height="51" /></a></p>
<p>2. Add a filter for the plugin_action_links filter. When the Plugins page is displayed in Admin, this filter will pass your function the links array.  Here&#8217;s the code:</p>
<pre class="brush: php;">

add_filter('plugin_action_links', array(&amp;$bwbPS, 'add_settings_link'), 10, 2 );
</pre>
<p>Note this part:  array(&amp;$bwbPS, &#8216;add_settings_link&#8217;)</p>
<p>If you&#8217;re putting your function inside a class, you need to use an array as a parameter, with your plugin&#8217;s instance variable&#8230;mine is $bwbPS.  The &#8220;&amp;&#8221; in front of the instance variable tells it to use the instance by reference (which I believe is automatic for objects anyway, but just do it <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).  The part after the &#8216;,&#8217; is the function name we&#8217;re calling.  You can name it whatever you like.</p>
<p>If you&#8217;re not placing your function inside a class, then you&#8217;re code will look like:</p>
<pre class="brush: php;">

add_filter('plugin_action_links', 'add_settings_link', 10, 2 );
</pre>
<p>But you&#8217;re going to want to make sure your function name is totally unique in the whole WordPress world.  Otherwise, POW!  Namespace collision.</p>
<p>Hope that helps!  It&#8217;s easy, and it&#8217;s so very helpful to have that link there.  I just love a plugin that has it because I don&#8217;t have to search for it in the sidebar, and secondly, I figure that the coder must know what he/she&#8217;s doing <img src='http://www.whypad.com/wp-includes/images/smilies/icon_razz.gif' alt=':P' class='wp-smiley' /> </p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=785&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/wordpress-add-settings-link-to-plugins-page/785/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WordPress ReWrite &#8211; new Plugin Coming and a Hint</title>
		<link>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/</link>
		<comments>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/#comments</comments>
		<pubDate>Fri, 02 Oct 2009 06:08:07 +0000</pubDate>
		<dc:creator>Byron Bennett</dc:creator>
				<category><![CDATA[Web]]></category>
		<category><![CDATA[Web Development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>

		<guid isPermaLink="false">http://www.whypad.com/?p=738</guid>
		<description><![CDATA[First of all, let me start by saying that Custom ReWriting in WordPress has consumed way more of my time than it ever should have.  I have prayed and pleaded, even considered asking one of the WordPress Gurus on their message board, but I&#8217;ve not had much luck getting responses there (questions were probably so [...]]]></description>
			<content:encoded><![CDATA[<p>First of all, let me start by saying that Custom ReWriting in WordPress has consumed way more of my time than it ever should have.  I have prayed and pleaded, even considered asking one of the WordPress Gurus on their message board, but I&#8217;ve not had much luck getting responses there (questions were probably so esoteric that nobody cared but me <img src='http://www.whypad.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ).</p>
<p><span id="more-738"></span></p>
<p>Finally, I have my new plugin working, I think!  It gives you an interface in the Admin for setting up your ReWrite Rules and then handles all the rest behind the scenes.  I&#8217;m not sure how robust it is, but it meets my needs.</p>
<p>I had 2 humongous problems that ate up 10 hours or more of my time.  Hope this helps you if you decide not to go the easy route and just you Smashly ReWriter (coming soon to a download near you!).</p>
<h2>Page ID, ID, Post ID, PageName, P</h2>
<p>The aliases for getting a page to come up in WP are nearly endless.  But when using $wp_rewrite rules, you have to be careful.  While index.php?page_id=245 might work for a post if you type it into a browser, save yourself, oh, about 6 hours and make sure you match up Pages with ?page_id= and Posts with ?p= when creating rewrite rules.</p>
<h2>&amp;amp; or &amp; ?</h2>
<p>Save yourself another 4 hours and don&#8217;t try to get fancy and write your urls the way you think they ought to be to be XHTML compliant&#8230;that is, using &amp;amp; to join multiple query variables.  Sometimes it doesn&#8217;t pay to be too proper.</p>
<p>A good xhtml url would have parameters inserted like:  state=NC&amp;amp;city=CLT</p>
<p>WP Rewriter wants it just plain ole:  state=NC&amp;city=CLT</p>
<p>Well, I hope the new plugin will help somebody out there.  I&#8217;m planning to release in the next few days over on <a href="http://smashly.net">Smashly.net</a>.  It makes this business about as simple as I can possibly come up with.  Hopefully some RegEx wizards will contribute some common match rules to help people along.</p>
<p>Cheers,</p>
<p>Byron</p>
<img src="http://www.whypad.com/?ak_action=api_record_view&id=738&type=feed" alt="" />]]></content:encoded>
			<wfw:commentRss>http://www.whypad.com/posts/wordpress-rewrite-new-plugin-coming-and-a-hint/738/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
