<?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>disable sidebar &#8211; mimoYmima</title>
	<atom:link href="/tag/disable-sidebar/feed/" rel="self" type="application/rss+xml" />
	<link>/</link>
	<description>Web Design Brooklyn</description>
	<lastBuildDate>Mon, 17 Aug 2015 19:07:07 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=5.3.2</generator>
	<item>
		<title>The smart way to disable your sidebar</title>
		<link>/disable-sidebar/</link>
				<comments>/disable-sidebar/#comments</comments>
				<pubDate>Thu, 11 Mar 2010 21:24:51 +0000</pubDate>
		<dc:creator><![CDATA[Brent Lagerman]]></dc:creator>
				<category><![CDATA[Lab]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[custom fields]]></category>
		<category><![CDATA[disable sidebar]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.mimoymima.com/?p=2936</guid>
				<description><![CDATA[<p>If you find yourself making a new WordPress template for pages that are identical to others on your site but just don't have a sidebar, consider this technique instead which lets you turn the sidebar off selectively on a page by page basis.</p>
<p>The post <a rel="nofollow" href="/disable-sidebar/">The smart way to disable your sidebar</a> appeared first on <a rel="nofollow" href="/">mimoYmima</a>.</p>
]]></description>
								<content:encoded><![CDATA[<p class="intro">If you find yourself making a new WordPress template for pages that are identical to others on your site but just don&#8217;t have a sidebar, consider this technique instead which lets you turn the sidebar off selectively on a page by page basis.</p>

<h2>Add this to functions.php</h2>
<pre class="crayon-plain-tag">&lt;?php // look to see if we've disabled sidebar in a custom field, if not show it
	$disableSidebar = get_post_meta($post-&gt;ID, 'disableSidebar', $single = true);
	if ($disableSidebar !== 'true') { get_sidebar(); }
?&gt;</pre>

<h2>index.php, page.php &#8230; etc.</h2>
<p>Next find the file that has the sidebar in it.  If you want this to work on all blog posts, it&#8217;s probably single.php, or if you add it to index.php and/or page.php it&#8217;ll work on other types of pages.  Once you find your sidebar you need to put a bit of code before it and a bit of code after it.  In the beginning bit looks to see if the custom field is set on your page, the second bit is just the end of the &#8216;if&#8217; statement</p>

<pre class="crayon-plain-tag">&lt;!--BEGIN: sidebar~main--&gt;
&lt;?php // to disable this sidebar on a page by page basis just add a custom field to your page or post of disableSidebar = true
$disableSidebar = get_post_meta($post-&gt;ID, 'disableSidebar', $single = true);
if ($disableSidebar !== 'true'): ?&gt;

&lt;!--BEGIN: my sidebar, yours may look a little different--&gt;
&lt;aside id=&quot;sidebar-main&quot;&gt;
	&lt;h1&gt;Main Sidebar&lt;/h1&gt;
	&lt;?php dynamic_sidebar('sidebar-main'); ?&gt;
&lt;/aside&gt;
&lt;!--END: my sidebar--&gt;

&lt;?php endif; ?&gt;
&lt;!--END: sidebar~main--&gt;</pre>

<h2>what it does</h2>

<p>It checks to see if you have a custom field set in your post to disable the sidebar and if you do it turns off the sidebar</p>

<h2>how to use it</h2>
<p>Just make a new custom field for your page called <strong>disableSidebar</strong> and set it to <strong>true</strong>.  That&#8217;s it.</p> <p>The post <a rel="nofollow" href="/disable-sidebar/">The smart way to disable your sidebar</a> appeared first on <a rel="nofollow" href="/">mimoYmima</a>.</p>
]]></content:encoded>
							<wfw:commentRss>/disable-sidebar/feed/</wfw:commentRss>
		<slash:comments>68</slash:comments>
							</item>
	</channel>
</rss>
