<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments for Glass Ocean</title>
	<atom:link href="http://glassocean.net/comments/feed/" rel="self" type="application/rss+xml" />
	<link>http://glassocean.net</link>
	<description>Perry Butler&#039;s Blog, Music Productions, Services, and Software Development.</description>
	<lastBuildDate>Sat, 10 Jul 2010 13:18:50 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by @kev_martin</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-220</link>
		<dc:creator>@kev_martin</dc:creator>
		<pubDate>Sat, 10 Jul 2010 13:18:50 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-220</guid>
		<description>Yep - I did indeed.  But thanks for making the effort anyway - I&#039;m sure others will benefit from the explanation :-)</description>
		<content:encoded><![CDATA[<p>Yep &#8211; I did indeed.  But thanks for making the effort anyway &#8211; I&#8217;m sure others will benefit from the explanation <img src='http://glassocean.net/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by Perry</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-215</link>
		<dc:creator>Perry</dc:creator>
		<pubDate>Sat, 10 Jul 2010 03:59:57 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-215</guid>
		<description>@kev_martin, looks like you have it figured out. I noticed a pending comment while I was still writing you an answer, guess I should have checked it!</description>
		<content:encoded><![CDATA[<p>@kev_martin, looks like you have it figured out. I noticed a pending comment while I was still writing you an answer, guess I should have checked it!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by Perry</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-214</link>
		<dc:creator>Perry</dc:creator>
		<pubDate>Sat, 10 Jul 2010 03:47:46 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-214</guid>
		<description>@kev_martin,

1. I believe this happens because WordPress processes shortcodes after the page has been rendered when it calls the_content, and echo seems to just render to the top of the page. You can modify the code above to &lt;strong&gt;return&lt;/strong&gt; the string rather than &lt;strong&gt;echo&lt;/strong&gt; the string, which should place it exactly where the shortcode appears in your post/page. Like this:

[vbnet]
function HelloWorld() {
    return &quot;&lt;p&gt;Hello World! This is my custom function.&lt;/p&gt;&quot;;
}
[/vbnet]

Notice the &lt;p&gt; tag which helps it appear like a paragraph would in your post/page.

2. You need to modify the function and shortcode slightly.

Change the function so it accepts the $atts argument. The $atts argument is an array containing however many attributes that we have chosen to pass to the function via the shortcode in a post/page. In this example we are only passing one attribute (name), so we &lt;strong&gt;extract&lt;/strong&gt; $atts to put the first attribute into a variable called &lt;strong&gt;name&lt;/strong&gt; ($name), whose value equals whatever we specify in the shortcode, unless we don&#039;t specify a value in which case a default name of &#039;Nobody&#039; is used:

[vbnet]
function HelloWorld($atts) {
    extract(shortcode_atts(array(&#039;name&#039; =&gt; &#039;Nobody&#039;,), $atts));
    return &quot;Hello World! My name is $name.&quot;;
}
[/vbnet]

Then change the shortcode in your post/page so it passes a value for the name parameter to the function.

&lt;pre&gt;
[hello name=&quot;perry&quot;]
&lt;/pre&gt;

Someone feel free to correct me if I&#039;m wrong, I&#039;m only a few weeks into PHP and WordPress development :)</description>
		<content:encoded><![CDATA[<p>@kev_martin,</p>
<p>1. I believe this happens because WordPress processes shortcodes after the page has been rendered when it calls the_content, and echo seems to just render to the top of the page. You can modify the code above to <strong>return</strong> the string rather than <strong>echo</strong> the string, which should place it exactly where the shortcode appears in your post/page. Like this:</p>
<pre class="brush: vb;">
function HelloWorld() {
    return &quot;&lt;p&gt;Hello World! This is my custom function.&lt;/p&gt;&quot;;
}
</pre>
<p>Notice the &lt;p&gt; tag which helps it appear like a paragraph would in your post/page.</p>
<p>2. You need to modify the function and shortcode slightly.</p>
<p>Change the function so it accepts the $atts argument. The $atts argument is an array containing however many attributes that we have chosen to pass to the function via the shortcode in a post/page. In this example we are only passing one attribute (name), so we <strong>extract</strong> $atts to put the first attribute into a variable called <strong>name</strong> ($name), whose value equals whatever we specify in the shortcode, unless we don&#8217;t specify a value in which case a default name of &#8216;Nobody&#8217; is used:</p>
<pre class="brush: vb;">
function HelloWorld($atts) {
    extract(shortcode_atts(array('name' =&gt; 'Nobody',), $atts));
    return &quot;Hello World! My name is $name.&quot;;
}
</pre>
<p>Then change the shortcode in your post/page so it passes a value for the name parameter to the function.</p>
<pre>
[hello name="perry"]
</pre>
<p>Someone feel free to correct me if I&#8217;m wrong, I&#8217;m only a few weeks into PHP and WordPress development <img src='http://glassocean.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by @kev_martin</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-213</link>
		<dc:creator>@kev_martin</dc:creator>
		<pubDate>Sat, 10 Jul 2010 03:22:57 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-213</guid>
		<description>All sorted now - with further help from http://codex.wordpress.org/Shortcode_API

Thanks again</description>
		<content:encoded><![CDATA[<p>All sorted now &#8211; with further help from <a href="http://codex.wordpress.org/Shortcode_API" rel="nofollow">http://codex.wordpress.org/Shortcode_API</a></p>
<p>Thanks again</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by Perry</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-212</link>
		<dc:creator>Perry</dc:creator>
		<pubDate>Sat, 10 Jul 2010 03:11:38 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-212</guid>
		<description>Jon, what you are seeing is actually from WordPress.com and not the WordPress.org Codex (unless you can point me in the right direction - I couldn&#039;t find it there). WordPress.com is a WordPress blog hosting service and they run a modified version of the WordPress software which adds the [contact-form] shortcode that you are mentioning, as well as several other shortcodes and features. I was plenty confused by this at first, just like you. That&#039;s partially why I wanted to write these tutorials.

If you want to use a contact form on a self hosted WordPress blog, check out one of the various Contact Form plugins at the &lt;a href=&quot;http://wordpress.org/extend/plugins/&quot; rel=&quot;nofollow&quot;&gt;WordPress.org Extend page&lt;/a&gt;.</description>
		<content:encoded><![CDATA[<p>Jon, what you are seeing is actually from WordPress.com and not the WordPress.org Codex (unless you can point me in the right direction &#8211; I couldn&#8217;t find it there). WordPress.com is a WordPress blog hosting service and they run a modified version of the WordPress software which adds the [contact-form] shortcode that you are mentioning, as well as several other shortcodes and features. I was plenty confused by this at first, just like you. That&#8217;s partially why I wanted to write these tutorials.</p>
<p>If you want to use a contact form on a self hosted WordPress blog, check out one of the various Contact Form plugins at the <a href="http://wordpress.org/extend/plugins/" rel="nofollow">WordPress.org Extend page</a>.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by Perry</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-210</link>
		<dc:creator>Perry</dc:creator>
		<pubDate>Sat, 10 Jul 2010 03:04:26 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-210</guid>
		<description>Hey kev, Jon, thank you very much for the constructive comments. Just dropping this quick reply to let you know I&#039;ll be answering your questions.</description>
		<content:encoded><![CDATA[<p>Hey kev, Jon, thank you very much for the constructive comments. Just dropping this quick reply to let you know I&#8217;ll be answering your questions.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by @kev_martin</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-209</link>
		<dc:creator>@kev_martin</dc:creator>
		<pubDate>Sat, 10 Jul 2010 01:59:49 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-209</guid>
		<description>Hmmm - following up on previous comment, I have a coupel of issues - hoping you can advise.

1.  Following your exact procedures, the &quot;Hello World! This is my custom function.&quot; appears at the top of the post, no matter where in the post I add the shortcode.

2. How do I pass a parameter to the function through the shortcode. e.g. in your example let&#039;s say we want it to say, &quot;&quot;Hello World! My name is xxx.&quot;  - How would we implement the name variable into the add_shortcode line of code, and how to add it in the shortcode itself?

Thanks again.</description>
		<content:encoded><![CDATA[<p>Hmmm &#8211; following up on previous comment, I have a coupel of issues &#8211; hoping you can advise.</p>
<p>1.  Following your exact procedures, the &#8220;Hello World! This is my custom function.&#8221; appears at the top of the post, no matter where in the post I add the shortcode.</p>
<p>2. How do I pass a parameter to the function through the shortcode. e.g. in your example let&#8217;s say we want it to say, &#8220;&#8221;Hello World! My name is xxx.&#8221;  &#8211; How would we implement the name variable into the add_shortcode line of code, and how to add it in the shortcode itself?</p>
<p>Thanks again.</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by @kev_martin</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-208</link>
		<dc:creator>@kev_martin</dc:creator>
		<pubDate>Sat, 10 Jul 2010 01:21:50 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-208</guid>
		<description>Thanks - exactly the information I was hunting for (I hope).  Lookign to create my own shortcode for including RSS feeds in my pages and posts.  There are numerous plugins to do that but none I have found that fully render the feeds with images etc.  So I have been relying on a manual php section in my index.php fileld with &#039;if else page=x&#039; etc

Hopefully this plan will work!</description>
		<content:encoded><![CDATA[<p>Thanks &#8211; exactly the information I was hunting for (I hope).  Lookign to create my own shortcode for including RSS feeds in my pages and posts.  There are numerous plugins to do that but none I have found that fully render the feeds with images etc.  So I have been relying on a manual php section in my index.php fileld with &#8216;if else page=x&#8217; etc</p>
<p>Hopefully this plan will work!</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on How to Use Custom PHP Functions and Shortcodes in WordPress by Jon</title>
		<link>http://glassocean.net/how-to-use-custom-php-functions-and-shortcodes-in-wordpress/comment-page-1/#comment-205</link>
		<dc:creator>Jon</dc:creator>
		<pubDate>Fri, 09 Jul 2010 22:15:52 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?p=684#comment-205</guid>
		<description>Thanks for the article.  I&#039;m a little lost with shortcodes. I see that some of them have to be made and added to a php file, but it also looks like some already exist inherently and all I&#039;m supposed to do is put the shortcode in a page or post?  For example, to get a contact form, Wordpress codex simply says add [contact-form] to a page or post.  I do that and nothing happens.  Is there more that I&#039;m supposed to do?  Thank you so much</description>
		<content:encoded><![CDATA[<p>Thanks for the article.  I&#8217;m a little lost with shortcodes. I see that some of them have to be made and added to a php file, but it also looks like some already exist inherently and all I&#8217;m supposed to do is put the shortcode in a page or post?  For example, to get a contact form, WordPress codex simply says add [contact-form] to a page or post.  I do that and nothing happens.  Is there more that I&#8217;m supposed to do?  Thank you so much</p>
]]></content:encoded>
	</item>
	<item>
		<title>Comment on Music Biography by Perry</title>
		<link>http://glassocean.net/music-productions/music-biography/comment-page-1/#comment-186</link>
		<dc:creator>Perry</dc:creator>
		<pubDate>Wed, 07 Jul 2010 17:53:55 +0000</pubDate>
		<guid isPermaLink="false">http://glassocean.net/?page_id=448#comment-186</guid>
		<description>Stop by, we still have your Maui gifts somewhere! I do enjoy Younger Brother. It&#039;s kind of ironic that you are posting about Shpongle and Simon Posford, because I just introduced their music to a friend of mine the other day and couldn&#039;t recall who the band consists of. Even more ironic is how I found out about Shpongle by searching for music related to another band I was thoroughly enjoying at the time called Hallucinogen. I didn&#039;t know it, but Hallucinogen is Simon Posford! You learn something new every day :)</description>
		<content:encoded><![CDATA[<p>Stop by, we still have your Maui gifts somewhere! I do enjoy Younger Brother. It&#8217;s kind of ironic that you are posting about Shpongle and Simon Posford, because I just introduced their music to a friend of mine the other day and couldn&#8217;t recall who the band consists of. Even more ironic is how I found out about Shpongle by searching for music related to another band I was thoroughly enjoying at the time called Hallucinogen. I didn&#8217;t know it, but Hallucinogen is Simon Posford! You learn something new every day <img src='http://glassocean.net/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>
