<?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>Social Bootstrap &#187; WordPress Plugins</title>
	<atom:link href="http://www.socialbootstrap.com/category/wordpress-plugins/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.socialbootstrap.com</link>
	<description>Creating Thought Leadership</description>
	<lastBuildDate>Fri, 22 Jan 2010 15:37:04 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.4</generator>
		<item>
		<title>WordPress Plugin Tutorial: Exclude Pages</title>
		<link>http://www.socialbootstrap.com/wordpress-plugin-tutorial-exclude-pages/</link>
		<comments>http://www.socialbootstrap.com/wordpress-plugin-tutorial-exclude-pages/#comments</comments>
		<pubDate>Wed, 16 Dec 2009 16:53:14 +0000</pubDate>
		<dc:creator>Adam</dc:creator>
				<category><![CDATA[Word Press]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Exclude Pages Plugin]]></category>
		<category><![CDATA[WP as CMS]]></category>

		<guid isPermaLink="false">http://www.socialbootstrap.com/?p=954</guid>
		<description><![CDATA[Using WP as CMS? Then you probably have wanted to exclude pages from the menu bar.]]></description>
			<content:encoded><![CDATA[<p>When using WordPress as a CMS, sometimes you have to trick out page menu bars. I often run sites with many static pages that I don&#8217;t want showing up in menus or (especially) in the commonly used horizontal page menu bar. And I don&#8217;t want to make them all child pages of something. That would be weird.</p>
<p>Thankfully, as with almost everything in WordPress, as soon as I realized I had a problem, I was able to find someone who had already solved it for me. The <a href="http://wordpress.org/extend/plugins/exclude-pages/">Exclude Pages Plugin</a> by <a href="http://www.simonwheatley.co.uk/">Simon Wheatley</a> adds a convenient little checkbox to the Page Edit page, asking if you want to include this page in page menus.</p>
<p>Fantastic.</p>
<h3>Changing the Default Setting on the Exclude Pages Plugin</h3>
<p>Most of the time when I&#8217;m using this plugin, it&#8217;s because I have some particular small group of pages I want displayed in navigation menus. I want the default to be &#8220;DO NOT include this page.&#8221; This makes me (and my clients who like to add pages and pages and ruin my beautiful navigation bars) have to think less.</p>
<p>Unfortunately, the default setting for the Exclude Pages plugin is &#8220;YES, include this page.&#8221; I wanted to change that.</p>
<p>If you&#8217;re using the Exclude Pages Plugin, and want to make the default setting an unchecked box, go into the exclude_pages.php file. (I did this right from the Plugin Editor inside the WordPress admin area.) Find the function called &#8220;ep_this_page_included&#8221; and change the first &#8220;return true&#8221; to &#8220;return false.&#8221;</p>
<p>Here&#8217;s what it looks like in the code:</p>
<p>BEFORE:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p954code1'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9541"><td class="code" id="p954code1"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> ep_this_page_included<span style="color: #009900;">&#40;</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;">$post_ID</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// New post? Must be included then.</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$post_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excluded_ids</span> <span style="color: #339933;">=</span> ep_get_excluded_ids<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// If there's no exclusion array, we can return true</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$excluded_ids</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Check if our page is in the exclusion array</span>
	<span style="color: #666666; font-style: italic;">// The bang (!) reverses the polarity [1] of the boolean</span>
	<span style="color: #b1b100;">return</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$excluded_ids</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// fn1. (of the neutron flow, ahem)</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>AFTER:</p>

<div class="wp_codebox_msgheader"><span class="right"><sup><a href="http://www.ericbess.com/ericblog/2008/03/03/wp-codebox/#examples" target="_blank" title="WP-CodeBox HowTo?"><span style="color: #99cc00">?</span></a></sup></span><span class="left"><a href="javascript:;" onclick="javascript:showCodeTxt('p954code2'); return false;">View Code</a> PHP</span><div class="codebox_clear"></div></div><div class="wp_codebox"><table><tr id="p9542"><td class="code" id="p954code2"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> ep_this_page_included<span style="color: #009900;">&#40;</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;">$post_ID</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// New post? Do NOT include!</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$post_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$excluded_ids</span> <span style="color: #339933;">=</span> ep_get_excluded_ids<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// If there's no exclusion array, we can return true</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <a href="http://www.php.net/empty"><span style="color: #990000;">empty</span></a><span style="color: #009900;">&#40;</span><span style="color: #000088;">$excluded_ids</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// Check if our page is in the exclusion array</span>
	<span style="color: #666666; font-style: italic;">// The bang (!) reverses the polarity [1] of the boolean</span>
	<span style="color: #b1b100;">return</span> <span style="color: #339933;">!</span> <a href="http://www.php.net/in_array"><span style="color: #990000;">in_array</span></a><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$excluded_ids</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #666666; font-style: italic;">// fn1. (of the neutron flow, ahem)</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>Now, new pages do not display in menus by default, but can easily be turned on in their Edit page if you want them to.</p>
<a class="a2a_dd addtoany_share_save" href="http://www.addtoany.com/share_save?linkurl=http%3A%2F%2Fwww.socialbootstrap.com%2Fwordpress-plugin-tutorial-exclude-pages%2F&amp;linkname=WordPress%20Plugin%20Tutorial%3A%20Exclude%20Pages"><img src="http://www.socialbootstrap.com/wp-content/plugins/add-to-any/share_save_120_16.png" width="120" height="16" alt="Share/Bookmark"/></a>]]></content:encoded>
			<wfw:commentRss>http://www.socialbootstrap.com/wordpress-plugin-tutorial-exclude-pages/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
	</channel>
</rss>

