<?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; advent</title>
	<atom:link href="http://wpengineer.com/tag/advent/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>Control When To Display WordPress Admin Bar</title>
		<link>http://wpengineer.com/2075/showing-control-of-the-wordpress-admin-bar/</link>
		<comments>http://wpengineer.com/2075/showing-control-of-the-wordpress-admin-bar/#comments</comments>
		<pubDate>Fri, 10 Dec 2010 09:56:24 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Admin Bar]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2075</guid>
		<description><![CDATA[On day 10 of our Advent Calendar we show a little code snippet for the WordPress Admin Bar. At first the easiest way to remove the Admin Bar with new function __return_false; include since WordPress 3.0. add_filter( &#039;show_admin_bar&#039;, &#039;__return_false&#039; ); Small Note: It give similar functions for return true __return_true, return zero __return_zero and return [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-10.jpg" alt="" title="WordPress-Christmas-2010-10" width="400" height="267" class="aligncenter size-full wp-image-2112" /><br />
On day 10 of our Advent Calendar we show a little code snippet for the WordPress Admin Bar. At first the easiest way to remove the Admin Bar with new function <code>__return_false</code>; include since WordPress 3.0.<br />
<span id="more-2075"></span></p>
<pre>
add_filter( &#039;show_admin_bar&#039;, &#039;__return_false&#039; );
</pre>
<p><strong>Small Note:</strong> It give similar functions for return true <code>__return_true</code>, return zero <code>__return_zero</code> and return empty array <code>__return_empty_array</code>.</p>
<p>If you like to deactivate the Admin Bar completely, you can use the following syntax and if you want adjust or extend. This example just lets user use the Admin Bar, who have the rights <code>manage_options</code>, in default only the administrator hast the rights.</p>
<pre>
function fb_show_admin_bar() {

	if ( current_user_can( &#039;manage_options&#039; ) )
		return TRUE;
	else
		return FALSE;
}
add_filter( &#039;show_admin_bar&#039;, &#039;fb_show_admin_bar&#039; );
</pre>
<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/2075/showing-control-of-the-wordpress-admin-bar/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Custom Pagination without WordPress Plugins</title>
		<link>http://wpengineer.com/2078/custom-pagination-without-wordpress-plugins/</link>
		<comments>http://wpengineer.com/2078/custom-pagination-without-wordpress-plugins/#comments</comments>
		<pubDate>Thu, 09 Dec 2010 10:41:09 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Pagination]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2078</guid>
		<description><![CDATA[On day 9 of our Advents Calendar we show a custom pagination function which allows a user to insert custom next, previous or numbered page links into a post. Use the follow code for an custom plugin or insert the function in your theme, inside the functions.php. Please see the second code-area for an example [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-09-300x200.jpg" alt="" title="WordPress-Christmas-2010-09" width="300" height="200" class="aligncenter size-medium wp-image-2100" /><br />
On day 9 of our Advents Calendar we show a custom pagination function which allows a user to insert custom next, previous or numbered page links into a post. Use the follow code for an custom plugin or insert the function in your theme, inside the functions.php. Please see the second code-area for an example to hook inside the function for custom parameters.<br />
<span id="more-2078"></span></p>
<h4>Example Screenshots</h4>
<p><img src="http://wpengineer.com/wp-content/uploads/wp-pagination2.png" alt="" title="wp-pagination2" width="138" height="41" class="size-full wp-image-2080" /> <img src="http://wpengineer.com/wp-content/uploads/wp-pagination.png" alt="" title="wp-pagination" width="145" height="74" class="size-full wp-image-2079" /></p>
<h4>The function</h4>
<p>Now the function for the pagination</p>
<pre>
function fb_paging_bar( $args = array() ) {

	$defaults = array(
		&#039;range&#039;           =&gt; 4,
		&#039;custom_query&#039;    =&gt; FALSE,
		&#039;previous_string&#039; =&gt; __( &#039;&laquo;&laquo;&laquo;&#039;, FB_GREYFOTO_TEXTDOMAIN ),
		&#039;next_string&#039;     =&gt; __( &#039;&raquo;&raquo;&raquo;&#039;, FB_GREYFOTO_TEXTDOMAIN ),
		&#039;view_fp&#039;         =&gt; TRUE,
		&#039;view_lp&#039;         =&gt; TRUE,
		&#039;before_output&#039;   =&gt; &#039;&lt;div class=&quot;postlink&quot;&gt;&#039;,
		&#039;after_output&#039;    =&gt; &#039;&lt;/div&gt;&#039;
	);

	$args = wp_parse_args(
		$args,
		apply_filters( &#039;fb_paging_bar_defaults&#039;, $defaults )
	);

	$args&#091;&#039;range&#039;&#093; = (int) $args&#091;&#039;range&#039;&#093; - 1;
	if ( !$args&#091;&#039;custom_query&#039;&#093; )
		$args&#091;&#039;custom_query&#039;&#093; = @$GLOBALS&#091;&#039;wp_query&#039;&#093;;
	$count = (int) $args&#091;&#039;custom_query&#039;&#093;-&gt;max_num_pages;
	$page  = intval( get_query_var( &#039;paged&#039; ) );
	$ceil  = ceil( $args&#091;&#039;range&#039;&#093; / 2 );

	if ( $count &lt;= 1 )
		return FALSE;

	if ( !$page )
		$page = 1;

	if ( $count &gt; $args&#091;&#039;range&#039;&#093; ) {
		if ( $page &lt;= $args&#091;&#039;range&#039;&#093; ) {
			$min = 1;
			$max = $args&#091;&#039;range&#039;&#093; + 1;
		} elseif ( $page &gt;= ($count - $ceil) ) {
			$min = $count - $args&#091;&#039;range&#039;&#093;;
			$max = $count;
		} elseif ( $page &gt;= $args&#091;&#039;range&#039;&#093; &amp;&amp; $page &lt; ($count - $ceil) ) {
			$min = $page - $ceil;
			$max = $page + $ceil;
		}
	} else {
		$min = 1;
		$max = $count;
	}

	$echo = &#039;&#039;;
	$previous = intval($page) - 1;
	$previous = esc_attr( get_pagenum_link($previous) );
	if ( $previous &amp;&amp; (1 != $page) )
		$echo .= &#039;&lt;a href=&quot;&#039; . $previous . &#039;&quot; title=&quot;&#039; . __( &#039;previous&#039;, FB_GREYFOTO_TEXTDOMAIN) . &#039;&quot;&gt;&#039; . $args&#091;&#039;previous_string&#039;&#093; . &#039;&lt;/a&gt;&#039;;
	$firstpage = esc_attr( get_pagenum_link(1) );

	if ( $args&#091;&#039;view_fp&#039;&#093; &amp;&amp; $firstpage &amp;&amp; (1 != $page) )
		$echo .= &#039;&lt;a href=&quot;&#039; . $firstpage . &#039;&quot;&gt;&#039; . __( &#039;First&#039;, FB_GREYFOTO_TEXTDOMAIN ) . &#039;&lt;/a&gt;&#039;;

	if ( !empty($min) &amp;&amp; !empty($max) ) {
		for( $i = $min; $i &lt;= $max; $i++ ) {
			if ($page == $i) {
				$echo .= &#039;&lt;span class=&quot;active&quot;&gt;&#039; . str_pad( (int)$i, 2, &#039;0&#039;, STR_PAD_LEFT ) . &#039;&lt;/span&gt;&#039;;
			} else {
				$echo .= sprintf( &#039;&lt;a href=&quot;%s&quot;&gt;%002d&lt;/a&gt;&#039;, esc_attr( get_pagenum_link($i) ), $i );
			}
		}
	}

	if ($args&#091;&#039;view_lp&#039;&#093;) {
		$lastpage = esc_attr( get_pagenum_link($count) );
		if ( $lastpage &amp;&amp; ($count != $page) ) {
			$count = str_pad( (int)$count, 2, &#039;0&#039;, STR_PAD_LEFT );
			$echo .= &#039;&lt;a href=&quot;&#039; . $lastpage . &#039;&quot;&gt;&#039; . __( &#039;Last&#039;, FB_GREYFOTO_TEXTDOMAIN ) . &#039;(&#039; . $count . &#039;)&#039; . &#039;&lt;/a&gt;&#039;;
		}
	}

	$next = intval($page) + 1;
	$next = esc_attr( get_pagenum_link($next) );
	if ($next &amp;&amp; ($count != $page) )
		$echo .= &#039;&lt;a href=&quot;&#039; . $next . &#039;&quot; title=&quot;&#039; . __( &#039;next&#039;, FB_GREYFOTO_TEXTDOMAIN) . &#039;&quot;&gt;&#039; . $args&#091;&#039;next_string&#039;&#093; . &#039;&lt;/a&gt;&#039;;

	if ( isset($echo) )
		echo $args&#091;&#039;before_output&#039;&#093; . $echo . $args&#091;&#039;after_output&#039;&#093;;
}
</pre>
<p>For use the function inside the templates use the follow syntax:</p>
<pre>
&lt;?php if ( function_exists(&#039;fb_paging_bar&#039;) ) fb_paging_bar(); ?&gt;
</pre>
<h4>Example for custom arguments</h4>
<p>For custom arguments, please use the filter. Also an example for this solution.</p>
<pre>
function change_fb_paging_bar_defaults($args) {

	$args&#091;&#039;previous_string&#039;&#093; = &#039;&#039;; // empty string
	$args&#091;&#039;next_string&#039;&#093; = &#039;&#039;;

	return $args;
}
add_filter(&#039;fb_paging_bar_defaults&#039;, &#039;change_fb_paging_bar_defaults&#039;);
</pre>
<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/2078/custom-pagination-without-wordpress-plugins/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Know The Constants Of An WordPress Installation</title>
		<link>http://wpengineer.com/2052/know-the-constants-of-an-wordpress-installation/</link>
		<comments>http://wpengineer.com/2052/know-the-constants-of-an-wordpress-installation/#comments</comments>
		<pubDate>Wed, 08 Dec 2010 10:50:13 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Constants]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2052</guid>
		<description><![CDATA[Today I will show you how to display the constants you use in your WordPress installation. Here is a small code snippet to list the defined constants. Please note: The output shows all defined constants, including the database and FTP password. Therefore please don't put it up online for everybody, let only admins access this [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-08-300x200.jpg" alt="" title="WordPress-Christmas-2010-08" width="300" height="200" class="alignleft size-medium wp-image-2093" />Today I will show you how to display the constants you use in your WordPress installation. Here is a small code snippet to list the defined constants.<br />
<span id="more-2052"></span><br />
<strong>Please note:</strong> The output shows all defined constants, including the database and FTP password. Therefore please don't put it up online for everybody, let only admins access this page. For the output of constants PHP has a <a href="http://php.net/manual/function.get-defined-constants.php">function</a>, which we will use and add a little bit code to create a readable list. You put the code in your Theme to have an output of all constants. Alternatively you can also create a Plugin to view a list of the constants.</p>
<pre>
print(&#039;&lt;pre&gt;&#039;);
print_r( @get_defined_constants() );
print(&#039;&lt;/pre&gt;&#039;);
</pre>
<p>To be sure, that only <a href="http://wpengineer.com/1906/display-private-posts-to-logged-in-users/">logged in user</a> can see the list, I will add an additional query to check if the user is logged in.</p>
<pre>
if ( is_user_logged_in() ) {
	print(&#039;&lt;pre&gt;&#039;);
	print_r( @get_defined_constants() );
	print(&#039;&lt;/pre&gt;&#039;);
}
</pre>
<p>The output can also be checked by <a href="http://codex.wordpress.org/Roles_and_Capabilities">user rights</a> with <code> if ( current_user_can('manage_options') ) {</code>. You can read more about it in a <a href="http://wpengineer.com/516/update-informations-only-for-admins/">previous article</a> or an <a href="http://wpengineer.com/2046/control-the-wordpress-content-via-userrights-or-time/">article with examples</a> for use the rights.</p>
<p>As an alternativ, the Plugins <a href="http://wordpress.org/extend/plugins/wp-system-health/">WP System Health</a> and <a href="http://wordpress.org/extend/plugins/debug-objects/">Debug Objects</a> can be very helpful, which lists all constants.<br />
Have fun!<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/2052/know-the-constants-of-an-wordpress-installation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WordPress Debug Bar</title>
		<link>http://wpengineer.com/2072/wordpress-debug-bar/</link>
		<comments>http://wpengineer.com/2072/wordpress-debug-bar/#comments</comments>
		<pubDate>Tue, 07 Dec 2010 10:59:13 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp3.1]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2072</guid>
		<description><![CDATA[With version 3.1 of WordPress comes the Admin Bar, which we introduced in a previous article, and this also allows to add your own entries. And so there is, created by the development team of WordPress, a Plugin for additional information available. The Plugin Debug Bar docks on the Admin Bar and gives, with one [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-07-300x200.jpg" alt="" title="WordPress-Christmas-2010-07" width="300" height="200" class="alignleft size-medium wp-image-2097" />With version 3.1 of WordPress comes the Admin Bar, which we introduced in a previous article, and this also allows to add your own entries. And so there is, created by the development team of WordPress, a Plugin for additional information available. The Plugin <a href="http://wordpress.org/extend/plugins/debug-bar/">Debug Bar</a> docks on the Admin Bar and gives, with one click on the new menu link, additional details of the installation.<br />
These include the query, cache, PHP messages and hints and tips for obsolete functions.<br />
<span id="more-2072"></span><br />
None of the data is contextual new; they were already available for developers, but displayed in a more readable way. Until now you have to use <a href="http://wordpress.org/extend/plugins/debug-objects/">one</a> of the free Plugins, which did the job for you and output all necessary information.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/debug-bar-31.png"><img src="http://wpengineer.com/wp-content/uploads/debug-bar-31-300x121.png" alt="The debug bar on backend of WordPress" title="debug-bar-31" width="300" height="121" class="aligncenter size-medium wp-image-2073" /></a></p>
<p>The Admin Bar is in backend and frontend available and makes a fast access to backend areas possible. This advantage applies also to the Debug Bar.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/debug-bar-31-frontend2.png"><img src="http://wpengineer.com/wp-content/uploads/debug-bar-31-frontend2-300x101.png" alt="" title="debug-bar-31-frontend2" width="300" height="101" class="aligncenter size-medium wp-image-2084" /></a></p>
<p><a href="http://wpengineer.com/wp-content/uploads/debug-bar-31-frontend.png"><img src="http://wpengineer.com/wp-content/uploads/debug-bar-31-frontend-300x179.png" alt="debug-bar-31-frontend" title="debug-bar-31-frontend" width="300" height="179" class="aligncenter size-medium wp-image-2074" /></a><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/2072/wordpress-debug-bar/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Plugin To Add Custom Field To An Attachment In WordPress</title>
		<link>http://wpengineer.com/2076/add-custom-field-attachment-in-wordpress/</link>
		<comments>http://wpengineer.com/2076/add-custom-field-attachment-in-wordpress/#comments</comments>
		<pubDate>Sun, 05 Dec 2010 09:30:20 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2076</guid>
		<description><![CDATA[The media library is on WordPress in some areas, certainly not perfect, but it has great potential. Each attachment can contain various metadata and also WordPress stores some data directly while uploading - for example a part of the Exif data of an image. However, it might not be enough for you and you need [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-05-300x200.jpg" alt="5 Day" title="WordPress-Christmas-2010-05" width="300" height="200" class="alignleft size-medium wp-image-2096" /><br />
The media library is on WordPress in some areas, certainly not perfect, but it has great potential. Each attachment can contain various <a href="http://wpengineer.com/126/image-metadata-in-wordpress/">metadata</a> and also WordPress stores some data directly while uploading - for example a part of the Exif data of an image.</p>
<p>However, it might not be enough for you and you need some additional custom data with the attachment, whether in order to control something in the backend of WordPress, or even display the data in the front end to the image. So here is a small tutorial how to add an additional field. You can use this solution directly and adding a new field with the help of a Plugin.<br />
<span id="more-2076"></span><br />
For the output of the data I present a simple method that can be adjusted accordingly. To read the data, which is assigned to the attachment, there are many functions provided by WordPress and enables you to realize so many amazing things - depending on knowledge and skills of the developer - such as <a href = "http://wpengineer.com/1735%20/%20shows%20easier-better-solutions-to-get-pictures-on-your-posts/">related articles</a>.</p>
<p><img src="http://wpengineer.com/wp-content/uploads/aaf-wp.png" alt="" title="aaf-wp" width="482" height="668" class="aligncenter size-full wp-image-2077" /></p>
<p>The above screenshot shows what we are aim for. An additional field with the name <em>Example Custom Field</em>, also an input field and a description below the field.</p>
<h3>Add the Custom Field</h3>
<p>First we create a function, which outputs the 3 new fields in the attachment area. These fields are getting delivered in an array and then via the according hook <code>attachment_fields_to_edit</code> integrated in WordPress.</p>
<pre>
// Add a custom field to an attachment in WordPress
function fb_attachment_fields_edit($form_fields, $post) {

	$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;label&#039;&#093; = __( &#039;Example Custom Field&#039;, FB_AAF_TEXTDOMAIN );
	$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;value&#039;&#093; = get_post_meta($post-&gt;ID, &#039;_custom_example&#039;, true);
	$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;helps&#039;&#093; = __( &#039;A helpful text for this field.&#039;, FB_AAF_TEXTDOMAIN );

	return $form_fields;
}
</pre>
<h3>Save the custom values</h3>
<p>Now that we have completed the data fields, we must take care about saving the values. For this case WordPress provides the hook <code>attachment_fields_to_save</code>, so that you only need to hook in the memory function.</p>
<pre>
// save custom field to post_meta
function fb_attachment_fields_save($post, $attachment) {

	if ( isset($attachment&#091;&#039;custom_example&#039;&#093;) )
		update_post_meta($post&#091;&#039;ID&#039;&#093;, &#039;_custom_example&#039;, $attachment&#091;&#039;custom_example&#039;&#093;);

	return $post;
}
</pre>
<h3>Hook to work in WordPress</h3>
<p>The two functions, explained before, providing the necessary functions and now we are going to integrate it into WordPress. Here a short explanation with the help of these two filter hooks. In both cases,  our functions passing <strong>two</strong> parameters to the hooks of WordPress and they are passed with the default value of <strong>priority 10</strong>. Everything goes through one filter in WordPress and therefore to hook on the respective <strong>Filter-Hook (<code>add_filter</code>) </strong> <code>attachment_fields_to_*</code>. The transfer via array <code>array(&#038;$this, ...</code> takes place here only because everything is used in connection within a class.</p>
<pre>
add_filter( &#039;attachment_fields_to_edit&#039;, array(&amp;$this, &#039;fb_attachment_fields_edit&#039;), 10, 2);
add_filter( &#039;attachment_fields_to_save&#039;, array(&amp;$this, &#039;fb_attachment_fields_save&#039;), 10, 2);
</pre>
<h3>The Example Plugin</h3>
<p>Now we incorporate the functions and their hooks in a Plugin and we can simple use the additional functions inside of WordPress. I think the separation of additional functions in Theme and Plugin is very important because the priority of integration is different and because from my point of view function expansions in a Theme are useful only if they are just additional functions for the Theme and not for WordPress.<br />
Also the use via class is useful, because of a cleaner code. But there are enough articles about the benefits of object-oriented programming and the usage of classes.</p>
<pre>
&lt;?php
/**
 * @package Add Attachment Fields
 * @author Frank B&uuml;ltge
 */

/*
Plugin Name: Add Attachment Fields
Plugin URI: http://bueltge.de/
Text Domain: add_attachment_fields
Domain Path: /languages
Description: Example for add a custom field to an attachment in WordPress
Author: Frank B&uuml;ltge
Version: 0.0.1
Author URI: http://bueltge.de/
Donate URI: http://bueltge.de/wunschliste/
License: GPL
Last change: 24.11.2010 10:21:19
*/ 

/**
License:
==============================================================================
Copyright 2009/2010 Frank Bueltge  (email : frank@bueltge.de)

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

Requirements:
==============================================================================
This plugin requires WordPress &gt;= 2.7 and tested with PHP Interpreter &gt;= 5.2.9
*/

//avoid direct calls to this file, because now WP core and framework has been used
if ( !function_exists(&#039;add_action&#039;) ) {
	header(&#039;Status: 403 Forbidden&#039;);
	header(&#039;HTTP/1.1 403 Forbidden&#039;);
	exit();
} elseif ( version_compare(phpversion(), &#039;5.0.0&#039;, &#039;&lt;&#039;) ) {
	$exit_msg = &#039;The plugin require PHP 5 or higher&#039;;
	header(&#039;Status: 403 Forbidden&#039;);
	header(&#039;HTTP/1.1 403 Forbidden&#039;);
	exit($exit_msg);
}

if ( !class_exists(&#039;add_attachment_fields&#039;) ) {

	//WordPress definitions
	if ( !defined(&#039;WP_CONTENT_URL&#039;) )
		define(&#039;WP_CONTENT_URL&#039;, get_option(&#039;siteurl&#039;) . &#039;/wp-content&#039;);
	if ( !defined(&#039;WP_CONTENT_DIR&#039;) )
		define(&#039;WP_CONTENT_DIR&#039;, ABSPATH . &#039;wp-content&#039;);
	if ( !defined(&#039;WP_PLUGIN_URL&#039;) )
		define(&#039;WP_PLUGIN_URL&#039;, WP_CONTENT_URL.&#039;/plugins&#039;);
	if ( !defined(&#039;WP_PLUGIN_DIR&#039;) )
		define(&#039;WP_PLUGIN_DIR&#039;, WP_CONTENT_DIR.&#039;/plugins&#039;);
	if ( !defined(&#039;PLUGINDIR&#039;) )
		define( &#039;PLUGINDIR&#039;, &#039;wp-content/plugins&#039; ); // Relative to ABSPATH.  For back compat.
	if ( !defined(&#039;WP_LANG_DIR&#039;) )
		define(&#039;WP_LANG_DIR&#039;, WP_CONTENT_DIR . &#039;/languages&#039;);

	// plugin definitions
	define( &#039;FB_AAF_BASENAME&#039;, plugin_basename(__FILE__) );
	define( &#039;FB_AAF_BASEDIR&#039;, dirname( plugin_basename(__FILE__) ) );
	define( &#039;FB_AAF_TEXTDOMAIN&#039;, &#039;add_attachment_fields&#039; );

	class add_attachment_fields {

		function __construct() {

			if ( !is_admin() )
				return FALSE;

			add_action( &#039;init&#039;, array(&amp;$this, &#039;text_domain&#039;) );
			add_filter( &#039;attachment_fields_to_edit&#039;, array(&amp;$this, &#039;fb_attachment_fields_edit&#039;), 10, 2);
			add_filter( &#039;attachment_fields_to_save&#039;, array(&amp;$this, &#039;fb_attachment_fields_save&#039;), 10, 2);
		}

		function text_domain() {

			load_plugin_textdomain( FB_AAF_TEXTDOMAIN, false, FB_AAF_BASEDIR . &#039;/languages&#039; );
		}

		// Add a custom field to an attachment in WordPress
		function fb_attachment_fields_edit($form_fields, $post) {

			$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;label&#039;&#093; = __( &#039;Example Custom Field&#039;, FB_AAF_TEXTDOMAIN );
			$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;value&#039;&#093; = get_post_meta($post-&gt;ID, &#039;_custom_example&#039;, true);
			$form_fields&#091;&#039;custom_example&#039;&#093;&#091;&#039;helps&#039;&#093; = __( &#039;A helpful text for this field.&#039;, FB_AAF_TEXTDOMAIN );

			return $form_fields;
		}

		// save custom field to post_meta
		function fb_attachment_fields_save($post, $attachment) {

			if ( isset($attachment&#091;&#039;custom_example&#039;&#093;) )
				update_post_meta($post&#091;&#039;ID&#039;&#093;, &#039;_custom_example&#039;, $attachment&#091;&#039;custom_example&#039;&#093;);

			return $post;
		}

	}

	function add_attachment_fields_start() {

		new add_attachment_fields();
	}

	add_action( &#039;plugins_loaded&#039;, &#039;add_attachment_fields_start&#039; );
}
?&gt;
</pre>
<h3>Example to use the values on Frontend or Plugins</h3>
<p>Additional to the Plugin, I have a small solution to output the meta data of the attachment. But I also recommend to read the previously mentioned <a href="http://wpengineer.com/1735/easier-better-solutions-to-get-pictures-on-your-posts/">article</a>, as you can get far more information there.</p>
<pre>
$attachments = get_children( array(
		&#039;post_parent&#039;    =&gt; get_the_ID(),
		&#039;post_type&#039;      =&gt; &#039;attachment&#039;,
		&#039;numberposts&#039;    =&gt; 1, // show all -1
		&#039;post_status&#039;    =&gt; &#039;inherit&#039;,
		&#039;post_mime_type&#039; =&gt; &#039;image&#039;,
		&#039;order&#039;          =&gt; &#039;ASC&#039;,
		&#039;orderby&#039;        =&gt; &#039;menu_order ASC&#039;
	) );
foreach ( $attachments as $attachment_id =&gt; $attachment ) {
	echo get_post_meta($attachment_id, &#039;_custom_example&#039;, true);
}
</pre>
<p>A practical example - photographer and its URL - has been recently posted by Thomas Scholz on <a href = "http://wordpress.stackexchange.com/questions/3097/how-can-i-add-a-url-field-to-the -attachments-window/3108 # 3108 ">WordPress Answers</a>. A nice usage for this possibility.<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/2076/add-custom-field-attachment-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>The PHP Functions min() and max()</title>
		<link>http://wpengineer.com/2081/the-php-functions-min-and-max/</link>
		<comments>http://wpengineer.com/2081/the-php-functions-min-and-max/#comments</comments>
		<pubDate>Sat, 04 Dec 2010 09:18:32 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Widgets]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2081</guid>
		<description><![CDATA[Today a small snippet, which I frequently use in my WordPress Widgets. It is about the determination of minimum and maximum values. Here is a piece of code from the WordPress Widget Recent Comments: if ( !$number = (int) $instance&#091;&#039;number&#039;&#093; ) $number = 10; else if ( $number &#60; 1 ) $number = 1; else [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-04-300x200.jpg" alt="" title="WordPress-Christmas-2010-04" width="300" height="200" class="alignnone size-medium wp-image-2091" /></p>
<p>Today a small snippet, which I frequently use in my WordPress Widgets. It is about the determination of minimum and maximum values. Here is a piece of code from the WordPress Widget Recent Comments:<br />
<span id="more-2081"></span></p>
<pre lang="php">
if ( !$number = (int) $instance&#091;&#039;number&#039;&#093; )
    $number = 10;
else if ( $number &lt; 1 )
    $number = 1;
else if ( $number &gt; 15 )
    $number = 15;
</pre>
<p>With the usage of the mathematical functions <strong>min()</strong> and <strong>max()</strong> we can do it in one line:</p>
<pre lang="php">
$number = isset ( $instance&#091;&#039;number&#039;&#093; ) ? min ( max ( 1, ( int ) $instance&#091;&#039;number&#039;&#093; ), 15 ) : 10;
</pre>
<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/2081/the-php-functions-min-and-max/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Custom WordPress Login-Page</title>
		<link>http://wpengineer.com/2053/custom-wordpress-login-page/</link>
		<comments>http://wpengineer.com/2053/custom-wordpress-login-page/#comments</comments>
		<pubDate>Thu, 02 Dec 2010 10:48:26 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2053</guid>
		<description><![CDATA[In a previous post I wrote about the possibility to adjust the login page in your WordPress backend. But I still receive a lot of questions about it and I would like to point out three simple ways, so that you can customize with little effort the login page to your site - a nice [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-02-300x200.jpg" alt="" title="WordPress-Christmas-2010-02" width="300" height="200" class="alignleft size-medium wp-image-2088" />In a previous post I wrote about the possibility to adjust the login page in your WordPress backend. But I still receive a lot of questions about it and I would like to point out three simple ways, so that you can customize with little effort the login page to your site - a nice added value in terms of customer projects which makes it look more professional instead having always the WordPress logo and the link displayed.<br />
<span id="more-2053"></span><br />
In the first step I adjust the logo to the login page. We wrote about it <a href="http://wpengineer.com/483/create-your-own-wordpress-login-design/">here already</a>. To make it simple, just write the stylesheet in the header, in our older tutorial we included an external stylesheet.</p>
<h4>Change Logo</h4>
<p>In the first code example I include the favicon, a fast and simple way. Alternatively you can include a logo of your Theme, therefore the 2nd code example. Each of the following example belongs into the functions.php of the Themes.</p>
<pre>
function fb_custom_login_logo() {
	$style = &#039;&lt;style type=&quot;text/css&quot;&gt; h1 a { background: transparent url(&#039; . get_bloginfo(&#039;url&#039;) . &#039;/favicon.ico) no-repeat 30px center !important; } &lt;/style&gt;&#039;;
	echo $style;
}
add_action( &#039;login_head&#039;, &#039;fb_custom_login_logo&#039; );
</pre>
<pre>
function fb_custom_login_logo() {
	$style = &#039;&lt;style type=&quot;text/css&quot;&gt; h1 a { background: transparent url(&#039; . get_bloginfo(&#039;template_directory&#039;) . &#039;/images/your-logo-image.png) no-repeat center top !important; } &lt;/style&gt;&#039;;
	echo $style;
}
add_action( &#039;login_head&#039;, &#039;fb_custom_login_logo&#039; );
</pre>
<p>Now we adjusted the logo, but the name at the hover effect is still not the one we want. Therefore is a hook available.</p>
<h4>Change name</h4>
<p>We correspond with the hook and deliver with the following code snippet the name of the blog, which lies in the database. Alternatively you can query static content or your own fields.</p>
<pre>
function fb_login_headertitle() {
	$name = get_option(&#039;blogname&#039;);
	echo $name;
}
add_filter( &#039;login_headertitle&#039;, &#039;fb_login_headertitle&#039; );
</pre>
<h4>Change link</h4>
<p>Now we want to adjust the link, so a klick on the logo will send us to the frontend of the website. And again, there is a hook available.</p>
<pre>
function fb_login_headerurl() {
	$url = bloginfo(&#039;url&#039;);
	echo $url;
}
add_filter( &#039;login_headerurl&#039;, &#039;fb_login_headerurl&#039; );
</pre>
<p>Three simple possibilities which should belong in almost every Theme. So that the login page perfectly fits to the website. It looks more professional and your customer will be thankful.<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/2053/custom-wordpress-login-page/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Post Formats – More Creative Ways For A Theme</title>
		<link>http://wpengineer.com/2082/post-formats-more-creative-ways-for-a-theme/</link>
		<comments>http://wpengineer.com/2082/post-formats-more-creative-ways-for-a-theme/#comments</comments>
		<pubDate>Wed, 01 Dec 2010 05:28:08 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[template_tag]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp3.1]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2082</guid>
		<description><![CDATA[First day of our Advent Calendar we show tiny code snippets and brief informations for the Post Formats from WordPress version 3.1. Some theme authors wanted more defined formats - they wanted the feature "post formats". This new functionality will be available in WordPress 3.1 and displays an additional meta-information. The Codex for this functionality [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010-01-300x200.jpg" alt="" title="WordPress-Christmas-2010-01" width="300" height="200" class="alignleft size-medium wp-image-2086" /><br />
First day of our Advent Calendar we show tiny code snippets and brief informations for the Post Formats from WordPress version 3.1.</p>
<p>Some theme authors wanted more defined formats - they wanted the feature "post formats". This new functionality will be available in WordPress 3.1 and displays an additional meta-information. The <a href="http://codex.wordpress.org/Post_Formats">Codex</a> for this functionality is available already, and now it's up to the theme authors to use this new feature.<br />
<span id="more-2082"></span><br />
To use this function, you have to activate it with the Theme. This is controlled, similar to other theme features since version 3.0, over a function. The following syntax gives some of the possible post formats and these can then be used directly on the article, as the following screenshot shows.</p>
<pre>
add_theme_support( &#039;post-formats&#039;, array( &#039;aside&#039;, &#039;audio&#039;, &#039;image&#039;, &#039;video&#039; ) );
</pre>
<p>Just put the code into your <em>functions.php</em> of your Themes.</p>
<p><a href="http://wpengineer.com/wp-content/uploads/wp31-postformats.png"><img src="http://wpengineer.com/wp-content/uploads/wp31-postformats-300x181.png" alt="" title="wp31-postformats" width="300" height="181" class="alignnone size-medium wp-image-2083" /></a></p>
<p>As possible keys are the following values available.</p>
<ul>
<li>default</li>
<li>aside</li>
<li>chat</li>
<li>gallery</li>
<li>link</li>
<li>image</li>
<li>quote</li>
<li>status</li>
<li>video</li>
<li>audio</li>
</ul>
<p>Like in <a href="http://www.tumblr.com/">thumblr</a> you can design the according article. Via the defined values you can use this across themes. The format will be output with the function <em>body_class()</em> for instant, which creates a class, which you can access via CSS. An exmaple for the value <em>Aside</em> of the post format.</p>
<pre>
&lt;body class=&quot;single single-post postid-52 single-format-aside&quot;&gt;
</pre>
<p>Alternatively there are conditional tags and functions to get to the assigned type:</p>
<pre>
 echo get_post_format();
</pre>
<p>As so often depends the creativity and usage on the developer. The biggest benefit is probably that defined values exist and as a theme author you can respond to these formats and as a developer you don't have to create a new meta box.</p>
<p><strong>Update</strong>: The UI received an update, see <a href="http://wpengineer.com/2082/post-formats-more-creative-ways-for-a-theme/#comment-5309">Andrew's comment</a>:</p>
<p><img src="http://wpengineer.com/wp-content/uploads/post-formats.jpg" alt="WordPress Post formats" title="WordPress Post formats" width="294" height="327" class="alignnone size-full wp-image-2119" /><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/2082/post-formats-more-creative-ways-for-a-theme/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Advent Calendar – 24 Days Tips And Tricks Each Day!</title>
		<link>http://wpengineer.com/2101/advent-calendar-%e2%80%93-24-days-tips-and-tricks-each-day/</link>
		<comments>http://wpengineer.com/2101/advent-calendar-%e2%80%93-24-days-tips-and-tricks-each-day/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 11:27:21 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=2101</guid>
		<description><![CDATA[Same procedure as every year! After the very successful Advent Calendar last year on WP Engineer we will provide our readers another Advent Calendar this year. What does it mean exactly? Especially in Germany we have the tradition of an Advent Calendar. An Advent calendar is a special calendar which is used to count down [...]]]></description>
			<content:encoded><![CDATA[<p>Same procedure as every year! After the very successful <a href="http://wpengineer.com/1875/advent-calendar-24-days-tips-and-tricks-each-day-today-wordpress-comment-form-widget/">Advent Calendar last year</a> on WP Engineer we will provide our readers another Advent Calendar this year. </p>
<h3>What does it mean exactly?</h3>
<p><span id="more-2101"></span><br />
<img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-2010.jpg" alt="" title="WordPress-Christmas-2010" width="600" height="400" class="aligncenter size-full wp-image-2102" />Especially in Germany we have the tradition of an Advent Calendar. An Advent calendar is a special calendar which is used to count down the days from December the 1st until Christmas Eve, December 24th.</p>
<p>An Advent Calendar has 24 doors, one of which is opened every day during Advent. Each door opens to reveal something, such as a toy or a chocolate item.</p>
<p>At WP Engineer, we thought we should do the same and open a door every day, which contains a little gift for our readers, by providing them a WordPress tip or trick each day. So we hope you will be exciting to see what tip, hack or news will be behind the door the next morning. Enjoy a new little WordPress gift every day until December 24th.</p>
<p>Sign up on our <a href="http://wpengineer.com/feed/">RSS Feed</a> or <a href="http://twitter.com/wpengineer">follow us on Twitter</a>, so you won't miss it when we open a new advent door every day!<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/2101/advent-calendar-%e2%80%93-24-days-tips-and-tricks-each-day/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>3rd Door &#8211; Today The Advice: Don&#8217;t Steal Premium WordPress Themes</title>
		<link>http://wpengineer.com/1876/3rd-door-today-the-advice-dont-steal-premium-wordpress-themes/</link>
		<comments>http://wpengineer.com/1876/3rd-door-today-the-advice-dont-steal-premium-wordpress-themes/#comments</comments>
		<pubDate>Thu, 03 Dec 2009 07:03:58 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[advent]]></category>
		<category><![CDATA[Advent Calendar]]></category>
		<category><![CDATA[Premium Theme]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1876</guid>
		<description><![CDATA[A friend called me and informed me that he had found two links in his footer to spam websites. He "found" the premium theme, which he was using "on the Internet". I have looked at the theme again and the footer.php was consisted of the following (shortened by me): $_F=__FILE__;$_X=&#039;Pz4JPGQ0diA0ZD0iZjIydDVyIj4NCgkJPHAgY(....) ==&#039;;eval(base64_decode(&#039;JF9YPW(...)Ow==&#039;)); I have decoded the [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/wp-content/uploads/WordPress-Christmas-03.jpg" alt="WordPress-Christmas-03" title="WordPress-Christmas-03" width="600" height="400" class="aligncenter size-full wp-image-1881" /><br />
A friend called me and informed me that he had found two links in his footer to spam websites. He "found" the premium theme, which he was using "on the Internet". I have looked at the theme again and the footer.php was consisted of the following (shortened by me):<br />
<span id="more-1876"></span></p>
<pre lang="php">
$_F=__FILE__;$_X=&#039;Pz4JPGQ0diA0ZD0iZjIydDVyIj4NCgkJPHAgY(....)
==&#039;;eval(base64_decode(&#039;JF9YPW(...)Ow==&#039;));
</pre>
<p>I have decoded the footer and it was "only" the original footer with two additional links to spam sites, together with the associated keywords. It could have been also some harmful code that makes it possible to break into your blog for example. What exactly the code is, that is not seen for a person without profound coding expertise.</p>
<p>Imagine that it is possible to break into the blog, or potentially damage the entire web space of the server. I wouldn't like to pay the invoice of your provider for the damage and surely don't want to lose my whole website and files. And all this because you wanted to save $59!</p>
<p>If you want to have a special theme, buy it! The theme developer also provide support within the $59, also many developer help with customization, updates and much more. A pretty good deal in my opinion. </p>
<p>So take the advice and rather buy a premium theme than download it for "free" somewhere else. The same applies also for premium Plugins.<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/1876/3rd-door-today-the-advice-dont-steal-premium-wordpress-themes/feed/</wfw:commentRss>
		<slash:comments>24</slash:comments>
		</item>
	</channel>
</rss>

