<?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>WP Engineer &#187; WP2.5</title>
	<atom:link href="http://wpengineer.com/tag/wp25/feed/" rel="self" type="application/rss+xml" />
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tips, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Sun, 22 Jan 2012 13:32:57 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Easy Way For Advertisement In WordPress</title>
		<link>http://wpengineer.com/378/easy-way-for-advertisement-in-wordpress/</link>
		<comments>http://wpengineer.com/378/easy-way-for-advertisement-in-wordpress/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 12:48:55 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Advertisement]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP2.5]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=378</guid>
		<description><![CDATA[Since version 2.5 WordPress introduced the shortcode API, more detail about it in our article „WordPress Shortcode API“. Recently I had a task which is surely common, but with the help of shortcode API and custom fields very easy to solve. I had to include some advertisements (in german: Werbung) into some articles. In each [...]]]></description>
			<content:encoded><![CDATA[<p>Since version 2.5 WordPress introduced the shortcode API, more detail about it in our article „<a href="http://wpengineer.com/?p=374">WordPress Shortcode API</a>“. Recently I had a task which is surely common, but with the help of shortcode API and custom fields very easy to solve. I had to include some advertisements (in german: Werbung) into some articles.</p>
<p>In each article the editor puts 3 custom fields: <em>bild (image), link, linktext</em>. In the text he can set the shortcode <code>[ad]</code>. This shortcode will be recognized by WordPress with the help of the following function. It will also load specific data to display the ads here.<br />
<span id="more-378"></span><br />
<div id="attachment_377" class="wp-caption aligncenter" style="width: 510px"><img src="http://wpengineer.com/wp-content/uploads/shortcode_werbung.png" alt="Easy advertisement with shortcode-API in WordPress" title="shortcode_ad" width="500" height="909" class="size-full wp-image-377" /><p class="wp-caption-text">Easy advertisement with shortcode-API in WordPress</p></div></p>
<p>The following function can be used as Plugin or put in <code>functions.php</code> of your theme.</p>
<pre lang="php">function example_link() {
	global $wp_query;

	$postID     = $wp_query-&gt;post-&gt;ID;
	$mylink     = get_post_custom_values(&#039;link&#039;, $postID);
	$mypic      = get_post_custom_values(&#039;bild&#039;, $postID);
	$mylinktext = get_post_custom_values(&#039;linktext&#039;, $postID);

	return &#039;&lt;a href=&quot;&#039; . $mylink&#091;0&#093; . &#039;&quot;&gt;&lt;img title=&quot;&#039; . $mylinktext&#091;0&#093; . &#039;&quot; src=&quot;&#039; . $mypic&#091;0&#093; . &#039;&quot; alt=&quot;&quot; /&gt;&lt;/a&gt;&#039;;
}

add_shortcode(&#039;werbung&#039;, &#039;example_link&#039;);</pre>
<p>In your content it will display the image with the link and link text. This is just an example and there are many other possibilities to use this. Of course you could get the data for link, image and link text from the other data fields, but a shortcode API makes it easier to include something like this in their post.<br />
<hr /><a href="http://wpplugins.com/plugin/281/snippets" title="More informations about this plugin for WordPress"><img src="http://wpengineer.com/wp-content/themes/wpe-3/images/snippets-125-125.png" height="90" alt="WordPress Snippet Plugin" /></a> <a href="http://xtreme-theme.com"><img src="http://wpengineer.com/wp-content/uploads/feed-banner-2.jpg" alt="Xtreme One WordPress Framework"/></a><br />
&copy; <a href="http://wpengineer.com/">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/378/easy-way-for-advertisement-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
	</channel>
</rss>

