<?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>Bright Cherry &#187; Wordpress</title>
	<atom:link href="http://www.brightcherry.co.uk/scribbles/category/wordpress/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.brightcherry.co.uk/scribbles</link>
	<description></description>
	<lastBuildDate>Fri, 11 May 2012 13:00:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=</generator>
		<item>
		<title>WordPress Excerpt Function Showing CSS #gallery-1</title>
		<link>http://www.brightcherry.co.uk/scribbles/wordpress-excerpt-function-showing-css-gallery-1/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/wordpress-excerpt-function-showing-css-gallery-1/#comments</comments>
		<pubDate>Tue, 05 Apr 2011 12:15:12 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=377</guid>
		<description><![CDATA[I had the strangest problem earlier. A client had reported that CSS code was showing on a category page, where only excerpts of a post should be showing. This is what it looked like: To cut a long story short, this issue was driving me insane, and I was frantically trying to pin down the [...]]]></description>
			<content:encoded><![CDATA[<p>I had the strangest problem earlier. A client had reported that CSS code was showing on a category page, where only excerpts of a post should be showing. This is what it looked like:</p>
<p><img src="http://www.brightcherry.co.uk/images/blogimages/excerpt_css.jpg" height="536" width="421" title="Wordpress Excerpt Function Showing CSS" alt="Wordpress Excerpt Function Showing CSS" /></p>
<p>To cut a long story short, this issue was driving me insane, and I was frantically trying to pin down the cause of the problem. I eventually tracked down the culprit. It was the <a href="http://wordpress.org/extend/plugins/events-calendar/" title="Events Calender plugin" target="new" rel="nofollow">Events Calender plugin</a>.</p>
<p>If you&#8217;ve installed the Events Calender plugin, and you&#8217;re experiencing the CSS bug, continue reading, I have a solution for you. If you&#8217;re experiencing this problem but DON&#8217;T have the plugin installed, I probably don&#8217;t have a solution for you. But the root of the problem maybe of a similar nature, as in a plugin you have installed is causing the issue.</p>
<h4>The solution for those that have the Events Calender plugin installed</h4>
<p><b>Step 1:</b> Find the file <b class="pink">eventcalandar3.php</b>, located in <b class="pink">/wp-content/plugins/event-calandar/</b>.</p>
<p><b>Step 2:</b> Find the following function, <b class="pink">ec3_get_the_excerpt</b>.</p>
<p><b>Step 3:</b><br />
Replace:</p>

<div class="wp_codebox"><table><tr id="p3773"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p377code3"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span><span style="color: #339933;">=</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>With:</p>

<div class="wp_codebox"><table><tr id="p3774"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p377code4"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$text</span><span style="color: #339933;">=</span><span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$text</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;style&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p><b>Step 4:</b><br />
Upload the new <b class="pink">eventcalandar3.php</b> file. I would suggest keeping a backup of the original file.</p>
<p>That should have resolved the problem. Phhheeeeew!</p>
<p>Please let me know if this helped anyone. I&#8217;m curious to know if this issue has plagued anyone else!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/wordpress-excerpt-function-showing-css-gallery-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress &#8211; Removing Unwanted Header Elements</title>
		<link>http://www.brightcherry.co.uk/scribbles/wordpress-removing-unwanted-header-elements/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/wordpress-removing-unwanted-header-elements/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 18:24:18 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=261</guid>
		<description><![CDATA[By default, WordPress tends to load a lot of junk in the header. So, for example, if you &#8220;view source&#8221; when looking at a wordpress blog post, you&#8217;ll typically see the following load in the header: 1 2 3 4 5 6 &#60;link rel=&#34;EditURI&#34; type=&#34;application/rsd+xml&#34; title=&#34;RSD&#34; href=&#34;&#34; /&#62; &#60;link rel=&#34;wlwmanifest&#34; type=&#34;application/wlwmanifest+xml&#34; href=&#34;wlwmanifest.xml&#34; /&#62; &#60;link rel='index' [...]]]></description>
			<content:encoded><![CDATA[<p>By default, WordPress tends to load a lot of junk in the header. So, for example, if you &#8220;view source&#8221; when looking at a wordpress blog post, you&#8217;ll typically see the following load in the header:</p>

<div class="wp_codebox"><table><tr id="p2617"><td class="line_numbers"><pre>1
2
3
4
5
6
</pre></td><td class="code" id="p261code7"><pre class="html" style="font-family:monospace;">&lt;link rel=&quot;EditURI&quot; type=&quot;application/rsd+xml&quot; title=&quot;RSD&quot; href=&quot;&quot; /&gt; 
&lt;link rel=&quot;wlwmanifest&quot; type=&quot;application/wlwmanifest+xml&quot; href=&quot;wlwmanifest.xml&quot; /&gt; 
&lt;link rel='index' title='BrightCherry' href='http://www.brightcherry.co.uk' /&gt; 
&lt;link rel='start' title='What is BrightCherry?' href='' /&gt; 
&lt;link rel='prev' title='' href='' /&gt; 
&lt;meta name=&quot;generator&quot; content=&quot;WordPress 2.9.2&quot; /&gt;</pre></td></tr></table></div>

<p>Most of it is unnecessary, and only delays the load time of the page. To prevent those elements from loading, you can add the following lines to the &#8220;functions.php&#8221; file which is located in your theme directory.</p>

<div class="wp_codebox"><table><tr id="p2618"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
</pre></td><td class="code" id="p261code8"><pre class="php" style="font-family:monospace;">remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'feed_links_extra'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">3</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the links to the extra feeds such as category feeds</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'feed_links'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes links to the general feeds: Post and Comment Feed</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'rsd_link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the link to the Really Simple Discovery service endpoint, EditURI link</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wlwmanifest_link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the link to the Windows Live Writer manifest file.</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'index_rel_link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the index link</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'parent_post_rel_link_wp_head'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the prev link</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'adjacent_posts_rel_link_wp_head'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the relational links for the posts adjacent to the current post.</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_generator'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the WordPress version i.e. - WordPress 2.8.4</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_shortlink_wp_head'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Removes the shortlink link</span>
remove_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'start_post_rel_link'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>Save the file, upload it. Next time you look at the source code, those unneeded elements won&#8217;t load.</p>
<p><strong>Note:</strong> I&#8217;ve tested this for WordPress version 3.0.1 and it works. All the actions above may not work for previous versions.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/wordpress-removing-unwanted-header-elements/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress- Display Google Adsense After 1st Paragraph Tag</title>
		<link>http://www.brightcherry.co.uk/scribbles/wordpress-display-google-adsense-after-1st-paragraph-tag/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/wordpress-display-google-adsense-after-1st-paragraph-tag/#comments</comments>
		<pubDate>Sun, 23 Aug 2009 00:06:42 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=161</guid>
		<description><![CDATA[I&#8217;ve been playing around with Google Adsense a lot lately- in particular trying to find out where the ads are best placed on a WordPress Blog to maximise click through rates (CTR). I&#8217;ve been looking at some wordpress plugins, but I couldn&#8217;t find any that allowed me to display an ad unit after the first [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been playing around with Google Adsense a lot lately- in particular trying to find out where the ads are best placed on a WordPress Blog to maximise click through rates (CTR). I&#8217;ve been looking at some wordpress plugins, but I couldn&#8217;t find any that allowed me to display an ad unit after the first paragraph, or even second, third or forth..etc.</p>
<p><img src="http://www.brightcherry.co.uk/images/blogimages/adsense.gif" title="Google Adsense" alt="Google Adsense" /></p>
<p>So I wrote some code which allowed me to do exactly that. In the single.php page, replace the following code:</p>

<div class="wp_codebox"><table><tr id="p16111"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p161code11"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<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></pre></td></tr></table></div>

<p>With&#8230;</p>

<div class="wp_codebox"><table><tr id="p16112"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
</pre></td><td class="code" id="p161code12"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$show_after_p</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_content'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_content</span><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: #990000;">substr_count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&gt;</span> <span style="color: #000088;">$show_after_p</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$contents</span> <span style="color: #339933;">=</span> <span style="color: #990000;">explode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;&lt;/p&gt;&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$p_count</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$contents</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</span>
	<span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p_count</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$show_after_p</span><span style="color: #009900;">&#41;</span>
		<span style="color: #009900;">&#123;</span>
		<span style="color: #000000; font-weight: bold;">?&gt;</span>
                INSERT ADSENSE CODE
		<span style="color: #000000; font-weight: bold;">&lt;?</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">&quot;&lt;/p&gt;&quot;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$p_count</span><span style="color: #339933;">++;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>That code will automatically display your Adsense unit after the first paragraph. You can modify <b class="pink">$show_after_p = 1</b>, which will control which paragraph you want the unit to display after. </p>
<p>If the $show_after_p value exceeds the amount of paragraphs there are in a post, the ad unit won&#8217;t display.</p>
<p>If anyone knows a better solution, please let me know. And if anyone decides to use the code, let me know if it works for you.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/wordpress-display-google-adsense-after-1st-paragraph-tag/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>WordPress: Displaying Parent Categories Only &amp; Putting Categories Into A Foreach Loop</title>
		<link>http://www.brightcherry.co.uk/scribbles/wordpress-displaying-parent-categories-only-putting-categories-into-a-foreach-loop/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/wordpress-displaying-parent-categories-only-putting-categories-into-a-foreach-loop/#comments</comments>
		<pubDate>Tue, 30 Jun 2009 10:07:53 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=145</guid>
		<description><![CDATA[I&#8217;ve been working with manipulating WordPress Categories a lot recently, so I&#8217;m just going to quickly jot down a few notes, as I&#8217;m sure I&#8217;ll need these in the future. From what i&#8217;m aware, currently, WordPress doesn&#8217;t allow enough flexibility when it comes to manipulating categories, especially when it comes to identifying the difference between [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working with manipulating WordPress Categories a lot recently, so I&#8217;m just going to quickly jot down a few notes, as I&#8217;m sure I&#8217;ll need these in the future. </p>
<p>From what i&#8217;m aware, currently, WordPress doesn&#8217;t allow enough flexibility when it comes to manipulating categories, especially when it comes to identifying the difference between a &#8220;Parent&#8221; and &#8220;Child&#8221; category. Let me explain&#8230; </p>
<h4>The &#8220;Depth&#8221; Parameter</h4>
<p>WordPress only recently added a &#8220;depth&#8221; parameter, which allows you to pull out ONLY parent or child categories. However, it still isn&#8217;t flexible enough because you can only use it with limited functions.</p>

<div class="wp_codebox"><table><tr id="p14516"><td class="line_numbers"><pre>1
2
3
4
</pre></td><td class="code" id="p145code16"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>ul<span style="color: #339933;">&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?php</span>
wp_list_categories<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'depth=1'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;/</span>ul<span style="color: #339933;">&gt;</span></pre></td></tr></table></div>

<p>The above code will list all parent categories in a list format. The downside of this approach? It&#8217;s not flexible enough because it lists the parent categories as links. But if that&#8217;s all you&#8217;re after, that&#8217;s cool. But If you want more flexibility with categories, that won&#8217;t help.</p>
<h4>Putting Categories Into a Foreach Loop And manipulating</h4>
<p>The solution to the problem above is as follows:</p>

<div class="wp_codebox"><table><tr id="p14517"><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
</pre></td><td class="code" id="p145code17"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$categories</span> <span style="color: #339933;">=</span> get_categories<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$categories</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$cat</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
  <span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">parent</span> <span style="color: #339933;">&lt;</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">category_nicename</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$cat</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">cat_name</span> <span style="color: #339933;">;</span>
   <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>The above code will put the categories into an array, meaning you can now pass the values through a foreach loop (as shown in the code), consequently, you can completely control how you want the categories to display. In the example, I&#8217;m only printing the category name and category nice name (category url). But you can print out a lot more, which I explain a bit further down</p>
<p>The <b class="pink">$cat->parent</b> variable prints the parent of each category. If the category doesn&#8217;t have a parent, it has a value of 0. So by adding the <b class="pink">if($cat->parent < 1)</b> condition, we prevent all child categories from displaying.</p>
<p>To view all the values in the array or further possible manipulation, print the following array:</p>

<div class="wp_codebox"><table><tr id="p14518"><td class="line_numbers"><pre>1
</pre></td><td class="code" id="p145code18"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">print_r</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$categories</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></td></tr></table></div>

<p>I hope that&#8217;s been useful <img src='http://www.brightcherry.co.uk/scribbles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/wordpress-displaying-parent-categories-only-putting-categories-into-a-foreach-loop/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>WordPress- Only Display Element On Homepage</title>
		<link>http://www.brightcherry.co.uk/scribbles/wordpress-only-display-element-on-homepage/</link>
		<comments>http://www.brightcherry.co.uk/scribbles/wordpress-only-display-element-on-homepage/#comments</comments>
		<pubDate>Mon, 20 Oct 2008 09:37:34 +0000</pubDate>
		<dc:creator>adm1n</dc:creator>
				<category><![CDATA[Wordpress]]></category>

		<guid isPermaLink="false">http://www.brightcherry.co.uk/scribbles/?p=78</guid>
		<description><![CDATA[A lot of the files in WordPress are used as includes e.g Sidebar, header and footer. What if you want certain elements in those includes to appear just on the Homepage? I find myself needing that feature all the time. Example All you really need is one simple function. So for example, in your header [...]]]></description>
			<content:encoded><![CDATA[<p>A lot of the files in WordPress are used as includes e.g Sidebar, header and footer. What if you want certain elements in those includes to appear just on the Homepage? I find myself needing that feature all the time.</p>
<h4>Example</h4>
<p>All you really need is one simple function. So for example, in your header you may have an image which you want to appear on the homepage:</p>
<p><img src="http://www.brightcherry.co.uk/images/logo.png" title="brightCherry Logo" alt="BrightCherry Logo" /></p>
<h4>The Code</h4>

<div class="wp_codebox"><table><tr id="p7821"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p78code21"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.brightcherry.co.uk/images/logo.png&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;brightCherry Logo&quot;</span> alt<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;BrightCherry Logo&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>If you use the above code, you will still see the image when you paginate to the second page of the homepage. If you strictly want it on the homepage, and no other pagination pages, you should use the following code:</p>

<div class="wp_codebox"><table><tr id="p7822"><td class="line_numbers"><pre>1
2
3
4
5
6
7
</pre></td><td class="code" id="p78code22"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span>is_home<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;/page/&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span>
<span style="color: #339933;">&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://www.brightcherry.co.uk/images/logo.png&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;brightCherry Logo&quot;</span> alt<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;BrightCherry Logo&quot;</span> <span style="color: #339933;">/&gt;</span>
<span style="color: #000000; font-weight: bold;">&lt;?</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></td></tr></table></div>

<p>Now the image will only appear on the homepage <img src='http://www.brightcherry.co.uk/scribbles/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://www.brightcherry.co.uk/scribbles/wordpress-only-display-element-on-homepage/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

