<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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/" version="2.0">

<channel>
	<title>WP Engineer</title>
	
	<link>http://wpengineer.com</link>
	<description>WordPress News, Hacks, Tipps, Tutorials, Plugins and Themes</description>
	<lastBuildDate>Fri, 13 Nov 2009 17:21:35 +0000</lastBuildDate>
	
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" />
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" href="http://feeds.feedburner.com/WpEngineer" type="application/rss+xml" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com" /><item>
		<title>WordPress Database Repair Script In 2.9</title>
		<link>http://wpengineer.com/wordpress-database-repair-script-in-2-9/</link>
		<comments>http://wpengineer.com/wordpress-database-repair-script-in-2-9/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 17:21:35 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Constants]]></category>
		<category><![CDATA[sql]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1836</guid>
		<description><![CDATA[A little tip for all users of the existing beta of WordPress 2.9 and for all who wish to update soon to the new version. With version 2.9 WordPress conducts its own routine to optimize the database. Previously it was done by either Plugins or via SQL access. From the next version this function is [...]]]></description>
			<content:encoded><![CDATA[<p>A little tip for all users of the existing beta of WordPress 2.9 and for all who wish to update soon to the new version. With version 2.9 WordPress conducts its own routine to optimize the database. Previously it was done by either Plugins or via SQL access. From the next version this function is implemented in the core ...<br />
<span id="more-1836"></span><br />
<a href="http://wpengineer.com/blog/wp-content/uploads/wprdb11.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/wprdb11-300x78.png" alt="wprdb1" title="wprdb1" width="300" height="78" class="aligncenter size-medium wp-image-1838" /></a></p>
<p>... which you can activate with the help of a constant; stored in <code>wp-config.php</code>, you have access to the script.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_ALLOW_REPAIR'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Call the script from the outside at the following address ...<br />
<code>http://example.com/wp-admin/maint/repair.php</code></p>
<p>... where you either repair the database or run the optimization. Technically, there is no magic behind this work, but the familiar SQL statements <a href="http://dev.mysql.com/doc/refman/5.1/en/analyze-table.html" class="liexternal"><code>ANALYZE TABLE</code></a>, <a href="http://dev.mysql.com/doc/refman/5.1/en/repair-table.html" class="liexternal"><code>REPAIR TABLE</code></a> and <a href="http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html" class="liexternal"><code>OPTIMIZE TABLE</code></a>.</p>
<p><a href="http://wpengineer.com/blog/wp-content/uploads/wprdb.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/wprdb-300x127.png" alt="wprdb" title="wprdb" width="300" height="127" class="aligncenter size-medium wp-image-1841" /></a></p>
<p>I guess that will start a debate, why with the constant and why from the outside, etc. - leave your comment here. Alternatively, anyone can contribute to WordPress and discuss directly with the developers or enter changes directly to the code.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/joomla-to-wordpress-content-converter/" rel="bookmark" title="Permanent Link: Joomla to WordPress &#8211; Content Converter!" class="liinternal">Joomla to WordPress &#8211; Content Converter!</a></li>
<li><a href="http://wpengineer.com/joomla-fireboard-wordpress-wp-forum-converter/" rel="bookmark" title="Permanent Link: Joomla Fireboard to WordPress WP-FORUM Converter" class="liinternal">Joomla Fireboard to WordPress WP-FORUM Converter</a></li>
<li><a href="http://wpengineer.com/use-constants-integrate-wordpress/" rel="bookmark" title="Permanent Link: Use Constants To Integrate WordPress In Other CMS" class="liinternal">Use Constants To Integrate WordPress In Other CMS</a></li>
<li><a href="http://wpengineer.com/blog-action-day-poverty-parallels-between-webdesign-and-real-world/" rel="bookmark" title="Permanent Link: Blog Action Day: Poverty &#8211; Parallels Between Webdesign And Real World!" class="liinternal">Blog Action Day: Poverty &#8211; Parallels Between Webdesign And Real World!</a></li>
<li><a href="http://wpengineer.com/wordpress-database-functions/" rel="bookmark" title="Permanent Link: WordPress Database Functions" class="liinternal">WordPress Database Functions</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-database-repair-script-in-2-9/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>WP Worldmap – Get to Know Your WordPress Neighbour!</title>
		<link>http://wpengineer.com/wp-worldmap-get-to-know-your-wordpress-neighbour/</link>
		<comments>http://wpengineer.com/wp-worldmap-get-to-know-your-wordpress-neighbour/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 17:10:23 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WPengineer Misc]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1822</guid>
		<description><![CDATA[Great idea by Oliver Schlöbe of WPSeek, who created the WP Worldmap. Now you can see where you can find all those WordPress Users and Developers. Don't forget to put your location and profile on the map. It's easy to zoom and move around. 
Great tool to get to know where a WordCamp is coming [...]]]></description>
			<content:encoded><![CDATA[<p>Great idea by <a href="http://www.schloebe.de/" class="liexternal">Oliver Schlöbe</a> of <a href="http://wpseek.com/" class="liexternal">WPSeek</a>, who created the <a href="http://wpworldmap.net/" class="liexternal">WP Worldmap</a>. Now you can see where you can find all those WordPress Users and Developers. Don't forget to put your location and profile on the map. It's easy to zoom and move around. </p>
<p>Great tool to get to know where a WordCamp is coming up or if another WordPress fan lives right next to your door!</p>
<p><a href="http://wpworldmap.net/" ><img src="http://wpengineer.com/blog/wp-content/uploads/WP-Worldmap2.jpg" alt="WP-Worldmap2" title="WP-Worldmap2" width="560" height="315" class="aligncenter size-full wp-image-1824" /></a><br />
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wp-worldmap-get-to-know-your-wordpress-neighbour/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Small Security Tipps for your WordPress Install</title>
		<link>http://wpengineer.com/small-security-tipps-for-your-wordpress-install/</link>
		<comments>http://wpengineer.com/small-security-tipps-for-your-wordpress-install/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 11:08:52 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1796</guid>
		<description><![CDATA[
WordPress enjoys great popularity and draw more attention of people who want to gain unauthorized access. As with any open-source software developers and attackers alike can view the code. The risk of spam links, the destruction of the blog and other attacks is therefore very high. But this article shows the possibilities to secure WordPress [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/blog/wp-content/uploads/Protect-WordPress.jpg" alt="Protect-WordPress" title="Protect-WordPress" width="560" height="336" class="aligncenter size-full wp-image-1809" /><br />
WordPress enjoys great popularity and draw more attention of people who want to gain unauthorized access. As with any open-source software developers and attackers alike can view the code. The risk of spam links, the destruction of the blog and other attacks is therefore very high. But this article shows the possibilities to secure WordPress in many ways.</p>
<p><span id="more-1796"></span><br />
There are many ways to secure a WordPress installation. In this article we will show only those who are easy to implement with little effort in WordPress. Which possibilities you use always depends on the different options available. For example, if you have access to the server's configuration, you can already create a high level of security. Here it is only about security settings within WordPress.</p>
<h3>Install WordPress securely</h3>
<p>WordPress is known for its simple and uncomplicated installation. This fact has contributed in particular to the popularity of the software, but also ensures that many settings are equally on many installations. This allows hackers to set up at various initial positions and gain unauthorized access.</p>
<p>Already during the installation of WordPress, you should pay attention that your own blog has less in common with a default installation of WordPress. An installation that differs from the standard, makes it more difficult for potential intruders to unauthorized access. In this context, you should consider a few points when setting up a new installation of WordPress.</p>
<p>All tips are limited to the possibilities of the basic installation without extensions. However, there are also some useful Plugins for more security in WordPress, which are particularly for less experienced users an alternative.</p>
<h3>Table prefix</h3>
<p>Access to the database is configured in <code>wp-config.php</code>. In this file, the table prefix is defined which uses WordPress to create the database at installation. By default, this is the prefix "wp_". You should always configure a random prefix that does not meet the standard. You should also make sure that you are using only numbers, letters and underscore, because other characters are not supported.</p>
<h3>Authentication Unique Keys</h3>
<p>Also in <code>wp-config.php</code>, you have the ability to define four security keys to increase the safety of WordPress. The keys either created manually or via a generator at <a href="http://api.wordpress.org/secret-key/1.1/" class="liwp">wordpress.org</a>. The four keys are assigned to different cookies and are used at different places in order to increase the security of WordPress, so it is also important that every installation has different keys. The relevant keys are:</p>
<ul>
<li><code>AUTH_KEY</code> 	Is used for unsecure connections via http.</li>
<li><code>SECURE_AUTH_KEY</code> 	This constant can be realized through https secure..</li>
<li><code>LOGGED_IN_KEY</code> 	holds firmly to whether a user has logged in, not an administrative cookie.</li>
<li><code>NONCE_KEY</code> 	appaers at <code>$_POST</code>-queries of WordPress and can be used via extension with function <code>wp_nonce()</code>.</li>
</ul>
<p>If you update an existing installation of WordPress, the key should be supplemented here by the example of <code>AUTH_KEY</code>:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'AUTH_KEY'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'put your unique phrase here'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>File and Folder Permissions</h3>
<p>Distinguish the rights of files and directories properly. Restricted Rights make it difficult for an attacker to alter files and directories.</p>
<p>Search engines usually take up to a certain depth, which they can get. Prevent using the <code>robots.txt </code>file to have access. The internal directory of WordPress shouldn't appear in any search results - a simple <code>Disallow</code> is enough.</p>
<p>Depending on server configuration, the possibility exists that you can list the contents of the folder in the browser. This must be prevented, which is quickly done by passing an empty <code>index.html</code> in each directory. Alternatively this can be done with the help of <a href="http://bueltge.de/wordpress-login-sicherheit-plugin/652/" class="liexternal">Secure WordPress Plugins</a>.</p>
<h3>Rename <code>wp-content</code></h3>
<p>All extensions, files and themes are stored in the default installation folder <code>wp-content</code>. Often, themes or Plugins opens a security hole in the system, so it is possible since version 2.6, to enter an arbitrary name for that folder, and storing the folder elsewhere. With a new installation it can be done easy and fast. It can lead to problems with Plugins or themes, since not all authors check this path by using the available constants and functions. Therefore, this option is only recommended for experienced users.</p>
<p>To redefine the folder, it is sufficient to establish that with the help of the constants in the <code>wp-config.php</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_CONTENT_DIR'</span><span style="color: #339933;">,</span> ABSPATH <span style="color: #339933;">.</span> <span style="color: #0000ff;">'test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// wp-content Directory</span>
<span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_CONTENT_URL'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http://example.com/test'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>    <span style="color: #666666; font-style: italic;">// wp-content URL</span></pre></div></div>

<h3>Secure access</h3>
<p>With version 2.6, a new option has been added to secure the back end of the installation: access via SSL - Secure Sockets Layer is an encryption protocol for transmitting data. Your internet provider must support the use of SSL. If so, you can enable the protocol in <code> wp-config.php </code>. To use the SSL capabilities in the backend, you must define <code>FORCE_SSL_LOGIN</code> with <code>TRUE</code>, not in quotes, it is a boolean value. From now on, all data is encrypted in the backend.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span> <span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'FORCE_SSL_LOGIN'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Safety of existing installations</h3>
<p>Also existing blogs can be made safer with a few simple steps. If the blog is already active and the database is already filled with content, changing the table prefix have fatal consequences. Yet there is also the possibility here to change the prefix. These various steps with the help of SQL is required that you perform in the most appropriate interface. Alternatively, you can go down that route with the help of a Plugin. Any changes to the database requires a backup of current database in advance.</p>
<p>To change all ten standard tables, the following SQL statements are necessary. Have you more tables, for example because of Plugins, they must also be changed. Adjust the sample <code>wp_i1d_</code> to your requirements.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">RENAME</span> TABLE wp_comments to wp_i1d_comments<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_links to wp_i1d_links<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_options to wp_i1d_options<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_postmeta to wp_i1d_postmeta<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_posts to wp_i1d_posts<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_terms to wp_i1d_terms<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_term_relationships to wp_i1d_term_relationships<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_term_taxonomy to i1d_term_taxonomy<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_usermeta to wp_i1d_usermeta<span style="color: #339933;">;</span>
<span style="color: #990000;">RENAME</span> TABLE wp_users to wp_i1d_users<span style="color: #339933;">;</span></pre></div></div>

<p>Unfortunately, WordPress uses the installation prefix, to clearly identify some of the fields in the tables <code>options</code> and <code>usermeta</code>. Therefore, you must rename these fields.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">UPDATE wp_i1d_options SET option_name <span style="color: #339933;">=</span> REPLACE<span style="color: #009900;">&#40;</span>option_name<span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_i1d_'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
UPDATE wp_i1d_usermeta SET meta_key <span style="color: #339933;">=</span> REPLACE<span style="color: #009900;">&#40;</span>meta_key<span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp_i1d_'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>Since Plugins may be able to create fields with the prefix, it is advisable if you now search the database for the old prefix and change the values.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">SELECT <span style="color: #339933;">*</span> FROM wp_i1d_options WHERE option_name LIKE <span style="color: #0000ff;">'wp_%'</span><span style="color: #339933;">;</span>
SELECT <span style="color: #339933;">*</span> FROM wp_i1d_usermeta WHERE meta_key LIKE <span style="color: #0000ff;">'wp_%'</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Rename Username</h3>
<p>The user name of the default installation is admin and not only known to you. After an installation you should delete this user. Be sure to create a new administrator. This is done in the administration area and should be the first act after the initial login.</p>
<p>This will change not only the user name, but also the ID, which is after the initial installation 1. Two fields that makes it easy for an attacker if you don't change them.</p>
<p>Would you like to set a very large value for the ID, the manual option in the backend is very complicated, because WordPress is adding to each new user only 1. Alternatively, you can change this value via SQL or with the Plugin <a href="http://bueltge.de/wp-suchen-und-ersetzen-de-plugin/114" class="liexternal">Search &#038; Replace</a>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">UPDATE `wp_users` SET `ID` <span style="color: #339933;">=</span> <span style="color: #0000ff;">'815'</span> WHERE `wp_users`<span style="color: #339933;">.</span>`ID` <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
UPDATE `wp_usermeta` SET `user_id` <span style="color: #339933;">=</span> <span style="color: #0000ff;">'815'</span> WHERE `wp_usermeta`<span style="color: #339933;">.</span>`user_id` <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
UPDATE `wp_posts` SET `post_author` <span style="color: #339933;">=</span> <span style="color: #0000ff;">'815'</span> WHERE `wp_posts`<span style="color: #339933;">.</span>`post_author` <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span>
UPDATE `wp_links` SET `link_owner` <span style="color: #339933;">=</span> <span style="color: #0000ff;">'815'</span> WHERE `wp_links`<span style="color: #339933;">.</span>`link_owner` <span style="color: #339933;">=</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Don't reveal WordPress version</h3>
<p>The version of WordPress is displayed in many parts of the blog, in your backend, feeds and in your theme. Each version has its quirks and errors that potential attackers are known.</p>
<p>For this reason, nobody should receive information about your WordPress installation. The simplest way to remove the version information from all areas (except the back end), is the use of <a href="http://bueltge.de/wordpress-login-sicherheit-plugin/652/" class="liexternal">Secure WordPress Plugins</a>. Alternatively, it is sufficient to suppress the function of publishing the release.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'the_generator'</span><span style="color: #339933;">,</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'$a'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;return null;&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Disable Error and Information messages</h3>
<p>The backend of WordPress can be reached via login with username and password. If the user produces an error, WordPress provides related tips to ease the login. As useful as the information for the user is, so it is also useful for unwanted intruders.</p>
<p>Consider whether you need to allow these messages, or want to, otherwise they can be disabled by the already mentioned Plugin <a href="http://bueltge.de/wordpress-login-sicherheit-plugin/652/" class="liexternal">Secure WordPress Plugin</a>.</p>
<p>If the constant <code>WP-DEBUG</code> is defined in your <code>wp-config.php</code>, you need to set it on <code>FALSE</code> or delete, otherwise any error in WordPress will be displayed in your browser. This constant should be used only in the development environment of WordPress.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_DEBUG'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h3>Security via <code>.htaccess</code></h3>
<p>The possibilities with <code>.htaccess</code> are various and we can also secure WordPress sufficiently. Specifically, the different requirements should be considered here, because not infrequently the usability suffers from the security settings. Consider the safety of WordPress also from the perspective of users, not only from the administrator. You should also note the configuration of your web space, so that there will be no errors.</p>
<p>In principle, any directory can be protected, especially the folder <code>wp-admin</code>, because there are the files to get access to your backend stored. Access is controlled via <code>wp-login.php</code> and WordPress always forwards to it, no matter which unauthorized call was placed in wp-admin. It must be added a <code>.htpasswd </code> file, that contains user name and password. Various online generators can help you create the file contents.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># protect wp-login.php
</span><span style="color: #339933;">&lt;</span>files wp<span style="color: #339933;">-</span>login<span style="color: #339933;">.</span>php<span style="color: #339933;">&gt;</span>
AuthName <span style="color: #0000ff;">&quot;Admin-Bereich&quot;</span>
AuthType Basic
AuthUserFile <span style="color: #339933;">/</span>your_lokal_path<span style="color: #339933;">/.</span>htpasswd
<span style="color: #b1b100;">require</span> valid<span style="color: #339933;">-</span>user
<span style="color: #339933;">&lt;/</span>files<span style="color: #339933;">&gt;</span></pre></div></div>

<p>As already mentioned, the file <code>wp-config.php</code> contains the accesses to the database, which makes them especially worthy of protection. A few lines in <code>.htaccess</code> of the root are helpful.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;"># protect wp-config.php
</span><span style="color: #339933;">&lt;</span>files wp<span style="color: #339933;">-</span>config<span style="color: #339933;">.</span>php<span style="color: #339933;">&gt;</span>
Order deny<span style="color: #339933;">,</span>allow
deny from all
<span style="color: #339933;">&lt;/</span>files<span style="color: #339933;">&gt;</span></pre></div></div>

<p>If the server environment allow an open directory environment, it is advisable to either store the main index.html in each directory or block access via "Options Indexes" in the .htaccess.</p>
<p>The folder <code> wp-content</code> and <code>wp-includes</code> are worthy to protect. The following syntax shows a simple method to protect the respective folder.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">Order Allow<span style="color: #339933;">,</span>Deny
Deny from all
<span style="color: #339933;">&lt;</span>Files ~ <span style="color: #0000ff;">&quot;js/tinymce/*.$&quot;</span><span style="color: #339933;">&gt;</span>
Allow from all
<span style="color: #339933;">&lt;/</span>Files<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>Files ~ <span style="color: #0000ff;">&quot;\.(css|jpe?g|png|gif|js)$&quot;</span><span style="color: #339933;">&gt;</span>
Allow from all
<span style="color: #339933;">&lt;/</span>Files<span style="color: #339933;">&gt;</span></pre></div></div>

<p>The file formats should be adapted and possibly be expanded and tested. Alternatively you can also use a Plugin solution that can greatly improve security and will decrease the work: <a href="http://www.askapache.com/wordpress/htaccess-password-protect.htm" class="liexternal">AskApache Password Protect</a>.</p>
<h3>Conclusion</h3>
<p>PHP and security have been and are frequently discussed and sometimes makes a web programmer pretty nervous. Security with PHP is not a "secret science", already with a few basics you can make a WordPress extension safer. Even WordPress itself provides this functionality. WordPress is much used in different configurations and versions of PHP, so that we can discuss the issue on different levels. The featured selections are simple and almost everywhere doable, which should not be ignored, if you want to keep your blog under your control.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-28-feature-password/" rel="bookmark" title="Permanent Link: WordPress 2.8 Feature Password" class="liinternal">WordPress 2.8 Feature Password</a></li>
<li><a href="http://wpengineer.com/quick-tipps-for-wordpress-query/" rel="bookmark" title="Permanent Link: Quick Tipps For WordPress Query" class="liinternal">Quick Tipps For WordPress Query</a></li>
<li><a href="http://wpengineer.com/batch-plugin-update-in-wordpress-2-9/" rel="bookmark" title="Permanent Link: Batch Plugin-Update in WordPress 2.9" class="liinternal">Batch Plugin-Update in WordPress 2.9</a></li>
<li><a href="http://wpengineer.com/the-perfect-title-tag/" rel="bookmark" title="Permanent Link: The Perfect Title Tag" class="liinternal">The Perfect Title Tag</a></li>
<li><a href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/small-security-tipps-for-your-wordpress-install/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>Use WordPress Login</title>
		<link>http://wpengineer.com/use-wordpress-login/</link>
		<comments>http://wpengineer.com/use-wordpress-login/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 10:19:00 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1773</guid>
		<description><![CDATA[WordPress makes it pretty easy to log in and out of WordPress in a theme. Basically with two functions


&#60;?php
$redirect = 'wp-admin/post-new.php';
if &#40; !is_user_logged_in&#40;&#41; &#41; &#123;
    $link = '&#60;a href=&#34;' . esc_url&#40; wp_login_url&#40; $redirect &#41; &#41; . '&#34;&#62;' . __&#40;'Login'&#41; . '&#60;/a&#62;';
&#125; else &#123;
    $link = '&#60;a href=&#34;' . esc_url&#40; [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress makes it pretty easy to log in and out of WordPress in a theme. Basically with two functions<br />
<span id="more-1773"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$redirect</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'wp-admin/post-new.php'</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>is_user_logged_in<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> esc_url<span style="color: #009900;">&#40;</span> wp_login_url<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$redirect</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Login'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;'</span> <span style="color: #339933;">.</span> esc_url<span style="color: #009900;">&#40;</span> wp_logout_url<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$redirect</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Logout'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$link</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// or echo apply_filters('loginout', $link);</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>But I'm not going into details - in this article I would like to go a little further and show how, for example, the login form gets into the theme. Thus adjustments to the design and integration to your own needs can be implemented very easily.<br />
<!--more--><br />
In the first example I want to show you the classic login form so its not too much code. The following syntax shows a simple login form in your theme. I have not made any further adjustments and used the default login form of WordPress.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_login_url<span style="color: #009900;">&#40;</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
	&lt;label for=&quot;log&quot;&gt;
		&lt;input type=&quot;text&quot; name=&quot;log&quot; id=&quot;log&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_login</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;22&quot; /&gt; User
	&lt;/label&gt;&lt;br /&gt;
	&lt;label for=&quot;pwd&quot;&gt;
		&lt;input type=&quot;password&quot; name=&quot;pwd&quot; id=&quot;pwd&quot; size=&quot;22&quot; /&gt; Password
	&lt;/label&gt;&lt;br /&gt;
	&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;Send&quot; class=&quot;button&quot; /&gt;
	&lt;label for=&quot;rememberme&quot;&gt;
		&lt;input name=&quot;rememberme&quot; id=&quot;rememberme&quot; type=&quot;checkbox&quot; checked=&quot;checked&quot; value=&quot;forever&quot; /&gt; Remember me
	&lt;/label&gt;
&lt;/form&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This is not always sufficient and depends on the users who are logged, and whether one can even register on the website, I wrote a little example which pays attention to various aspects.<br />
<a href="http://wpengineer.com/blog/wp-content/uploads/loginform.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/loginform.png" alt="loginform" title="loginform" width="217" height="115" class="alignleft size-full wp-image-1774" /></a></p>
<p>The following syntax is the view of logged user (<code> if ($ user_ID) </code>) , which is a completely different to new users, they get the form only if they are allowed to register (<code>get_option('users_can_register')</code>) , depending on the settings in the backend of WordPress.<br />
Similarly, users with a User_Level greater than 1 (<code>if ( $user_level &gt;= 1 )</code>) get one link more to write an article. Alternatively, you can also use the function <code>current_user_can()</code> and therefore explicitly asked for the user role.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$user_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_identity</span><span style="color: #339933;">,</span> <span style="color: #000088;">$user_level</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_ID</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
	&lt;h3&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Control panel'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt;
	&lt;ul&gt;
		&lt;li&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Identified as'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> &lt;strong&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$user_identity</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/strong&gt;.
			&lt;ul&gt;
				&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-admin/&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Dashboard'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
&nbsp;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$user_level</span> <span style="color: #339933;">&gt;=</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
					&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-admin/post-new.php&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Write an article'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
				&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>/wp-admin/profile.php&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Profile'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
				&lt;li&gt;&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> esc_url<span style="color: #009900;">&#40;</span> wp_logout_url<span style="color: #009900;">&#40;</span> <span style="color: #990000;">urlencode</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: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Exit'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;&lt;/li&gt;
			&lt;/ul&gt;
		&lt;/li&gt;
	&lt;/ul&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'users_can_register'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;h3&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Identification'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt;
		&lt;ul&gt;
			&lt;li&gt;
				&lt;form action=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_login_url<span style="color: #009900;">&#40;</span>get_permalink<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; method=&quot;post&quot;&gt;
					&lt;p&gt;
						&lt;label for=&quot;log&quot;&gt;
							<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'User'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
							&lt;input type=&quot;text&quot; name=&quot;log&quot; id=&quot;log&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wp_specialchars<span style="color: #009900;">&#40;</span><span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$user_login</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; size=&quot;22&quot; /&gt;
						&lt;/label&gt;&lt;br /&gt;
						&lt;label for=&quot;pwd&quot;&gt;
							<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Password'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
							&lt;input type=&quot;password&quot; name=&quot;pwd&quot; id=&quot;pwd&quot; size=&quot;22&quot; /&gt;
						&lt;/label&gt;&lt;br /&gt;
						&lt;input type=&quot;submit&quot; name=&quot;submit&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Send'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; class=&quot;button&quot; /&gt;
						&lt;label for=&quot;rememberme&quot;&gt;
							&lt;input name=&quot;rememberme&quot; id=&quot;rememberme&quot; type=&quot;checkbox&quot; checked=&quot;checked&quot; value=&quot;forever&quot; /&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Remember me'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
						&lt;/label&gt;&lt;br /&gt;
						&lt;input type=&quot;hidden&quot; name=&quot;redirect_to&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</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: #000000; font-weight: bold;">?&gt;</span>&quot;/&gt;
					&lt;/p&gt;
				&lt;/form&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-login.php?action=register'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Register'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
			&lt;/li&gt;
			&lt;li&gt;
				&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> site_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp-login.php?action=lostpassword'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'login'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>	 <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Recover password'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
			&lt;/li&gt;
		&lt;/ul&gt;
&nbsp;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>If user level is insufficient, you may also extend WordPress, either via code or using a Plugin.<br />
With the help of a few lines of PHP you can assign a role quickly.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_new_object<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_roles</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$wp_roles</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">add_cap</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'administrator'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'MyObject'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// start an activation theme</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'activated'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$pagenow</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'themes.php'</span> <span style="color: #009900;">&#41;</span>
	my_new_object<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The object can simply be requested via standard.<br />
<code>if ( current_user_can('MyObject') )</code></p>
<p>Alternatively you can also create new roles: <code>add_role('New_Role', 'New name of the role');</code>. The function also allows the simultaneous use of rights, therefore a third optional parameter is available, which expects several values in an array. Otherwise, the objects can be add via <code>add_cap()</code>.</p>
<p>This is only a small approach, many opportunities arise - have fun with the benefits of these possibilities.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/removing-wordpress-login-design/" rel="bookmark" title="Permanent Link: Removing WordPress Login Design" class="liinternal">Removing WordPress Login Design</a></li>
<li><a href="http://wpengineer.com/create-your-own-wordpress-login-design/" rel="bookmark" title="Permanent Link: Create Your Own WordPress Login Design" class="liinternal">Create Your Own WordPress Login Design</a></li>
<li><a href="http://wpengineer.com/wordpress-ftp-data-with-constant/" rel="bookmark" title="Permanent Link: WordPress FTP Data With Constant" class="liinternal">WordPress FTP Data With Constant</a></li>
<li><a href="http://wpengineer.com/update-informations-only-for-admins/" rel="bookmark" title="Permanent Link: Update Informations Only for Admins" class="liinternal">Update Informations Only for Admins</a></li>
<li><a href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/use-wordpress-login/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>WordPress 2.9 add_theme_support and has_post_image</title>
		<link>http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/</link>
		<comments>http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/#comments</comments>
		<pubDate>Tue, 03 Nov 2009 21:16:55 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[post_thumbnail]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1779</guid>
		<description><![CDATA[The new  the_post_image functionality in WordPress version 2.9 has been enhanced.
New is the wp-settings.php line


// Load in support for template functions which the theme supports
require_if_theme_supports&#40; 'post-thumbnails', ABSPATH . WPINC . '/post-image-template.php' &#41;;

In functions.php it queries whether the theme supports post-thumbnail function:

if &#40; function_exists&#40; 'add_theme_support' &#41; &#41;
	add_theme_support&#40; 'post-thumbnails' &#41;;

If you look at the file wp-includes/post-image-template.php, [...]]]></description>
			<content:encoded><![CDATA[<p>The new <a href="http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/" title="Article New feature in WordPress 2.9 – the_post_image()" class="liinternal"><strong> the_post_image</strong ></a> functionality in WordPress version 2.9 has been enhanced.<br />
New is the wp-settings.php line<br />
<span id="more-1779"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Load in support for template functions which the theme supports</span>
require_if_theme_supports<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span><span style="color: #339933;">,</span> ABSPATH <span style="color: #339933;">.</span> WPINC <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/post-image-template.php'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In functions.php it queries whether the theme supports post-thumbnail function:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'add_theme_support'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	add_theme_support<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post-thumbnails'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>If you look at the file wp-includes/post-image-template.php, there are 4 new features:</p>
<ul>
<li><strong>has_post_image()</strong></li>
<li><strong>get_post_image_id()</strong></li>
<li><strong>the_post_image()</strong></li>
<li><strong>get_the_post_image()</strong></li>
</ul>
<p>The theme itself can check within the loop, if the post has a Post-Thumbnail, and if so, then it can be output:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> has_post_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_permalink<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>&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post_image<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">75</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">75</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'class'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'alignleft'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/a&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">endif</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Those interested in more features and information should check the file in WordPress 2.9: <code>wp-includes/post-image-template.php</code><br />
Especially the function: <code>get_the_post_image</code><br />
It allows to adjust the output by using hooks.<br />
In <code>get_the_post_image</code> the function <code>wp_get_attachment_image</code> get also used, what has been explained in detail in <a href="http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/" class="liinternal">this post just a few days ago</a>.</p>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Batch Plugin-Update in WordPress 2.9</title>
		<link>http://wpengineer.com/batch-plugin-update-in-wordpress-2-9/</link>
		<comments>http://wpengineer.com/batch-plugin-update-in-wordpress-2-9/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 10:58:37 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[update]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1766</guid>
		<description><![CDATA[In the past we have already informed you a little bit about the new features of the upcoming 2.9 version of WordPress - the development does not stop and the next version has many minor changes. Improvements in security, administration.
WordPress 2.9 will have the possibility to update all your Plugins, which have an update available, [...]]]></description>
			<content:encoded><![CDATA[<p>In the past we have already informed you a little bit about the new features of the upcoming 2.9 version of WordPress - the development does not stop and the next version has many minor changes. Improvements in security, administration.</p>
<p>WordPress 2.9 will have the possibility to update all your Plugins, which have an update available, in one step.<br />
That makes maintenance work with customer's and on your own blog more simple and faster. As a little insight, here is a screenshot of the current beta.</p>
<p><a href="http://wpengineer.com/blog/wp-content/uploads/plugin-update-29.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/plugin-update-29-300x291.png" alt="plugin-update-29" title="plugin-update-29" width="300" height="291" class="aligncenter size-medium wp-image-1767" /></a><br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/update-informations-only-for-admins/" rel="bookmark" title="Permanent Link: Update Informations Only for Admins" class="liinternal">Update Informations Only for Admins</a></li>
<li><a href="http://wpengineer.com/warning-message-for-self-customized-plugins/" rel="bookmark" title="Permanent Link: Warning Message For Self Customized Plugins" class="liinternal">Warning Message For Self Customized Plugins</a></li>
<li><a href="http://wpengineer.com/use-wordpress-27-offline/" rel="bookmark" title="Permanent Link: Use WordPress 2.7 Offline" class="liinternal">Use WordPress 2.7 Offline</a></li>
<li><a href="http://wpengineer.com/wordpress-27-update-core/" rel="bookmark" title="Permanent Link: WordPress 2.7 Update Core" class="liinternal">WordPress 2.7 Update Core</a></li>
<li><a href="http://wpengineer.com/wordpress-updates-via-ftp-on-windows-xampp-installations/" rel="bookmark" title="Permanent Link: WordPress Updates via FTP on Windows XAMPP installations" class="liinternal">WordPress Updates via FTP on Windows XAMPP installations</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/batch-plugin-update-in-wordpress-2-9/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Easier And Better Solutions To Get Pictures On Your Posts</title>
		<link>http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/</link>
		<comments>http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/#comments</comments>
		<pubDate>Tue, 20 Oct 2009 11:04:24 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1735</guid>
		<description><![CDATA[WordPress makes it pretty easy to upload picture on posts and pages. Thereby are various data stored, which can be used.
Again and again, you can read tutorials on how to bring photos to posts, normally this is a solution via the custom fields. But there is a different and simpler solution, I think. The maintenance [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress makes it pretty easy to upload picture on posts and pages. Thereby are various data stored, which can be used.<br />
Again and again, you can read tutorials on how to bring photos to posts, normally this is a solution via the custom fields. But there is a different and simpler solution, I think. The maintenance of custom fields is not always necessary.<br />
Therefore, I would like to show some solutions that are, in my opinion, much better and can be expanded in many ways.</p>
<p><span id="more-1735"></span></p>
<h3>With custom fields</h3>
<p>In the first case, the solution using a custom field to be displayed, while the data must be maintained in this field to a key.</p>
<p>In version 1 you store the value of the authors to the key <code>author link</code>, so it's easy to understand the use of the fields. More information about this can be found in the <a href="http://codex.wordpress.org/Using_Custom_Fields" class="liwp">Codex</a>.</p>
<h4>Version 1</h4>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-cf.png" alt="wp-cf" title="wp-cf" width="450" height="209" class="aligncenter size-full wp-image-1736" /><br />
The output of the key is handed over by using the template tag <code>get_post_meta()</code>. The function expects the Id of the post and the key value as a mandatory, or alternatively you can set if a value or arrays are allowed. Put on <code>true</code> and it returns only a string</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param int $post_id Post ID.
 * @param string $key The meta key to retrieve.
 * @param bool $single Whether to return a single value.
 * @return mixed Will be an array if $single is false. Will be value of meta data field if $single
 *  is true.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$single</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'authorlink'</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;p&gt;Photo of &lt;a href=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span><span style="color: #000000; font-weight: bold;">?&gt;</span>&quot;&gt;&lt;/a&gt;.&lt;/p&gt;</pre></div></div>

<p>The next step is basically no different, except that we now put the address in a value to another key, where the picture is. This requires the author to know address and save the URL.<br />
<img src="http://wpengineer.com/blog/wp-content/uploads/wp-cf2.png" alt="wp-cf2" title="wp-cf2" width="450" height="207" class="aligncenter size-full wp-image-1737" /></p>
<p>In version 2, however, we go one step further and put a function into the <code>functions.php</code>, which takes care of it and then we can feed it with data. Again, this is just an example and needs in this version the key of the custom fields, the width and height of the images. These three sample values, we then write in the tag to output the image.</p>
<h4>Version 2</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/*Custom Field Images*/</span>
<span style="color: #000000; font-weight: bold;">function</span> image_attachment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$width</span><span style="color: #339933;">,</span> <span style="color: #000088;">$height</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$post</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #000088;">$custom_field</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</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: #000088;">$custom_field</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$custom_field</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;Post Image&quot; width=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$width</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; height=&quot;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$height</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
		<span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The output of the template is determined by the above function as follows.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$image_key</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myimage</span> <span style="color: #339933;">=</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$image_key</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</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: #000088;">$myimage</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;div class=&quot;post-image&quot;&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> image_attachment<span style="color: #009900;">&#40;</span><span style="color: #000088;">$image_key</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">512</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
	&lt;/div&gt;
<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This really can make some beautiful things. Many theme authors would like to just have a picture to a post, which is directly taken at various points. Often this is achieved through the above solution. However, this requires that the authors need to know the custom fields and maintain them, so the key of the custom field and URL to the image.</p>
<p>Not very comfortable, so I want to show a solution, how you can get the image that was uploaded to the post, which can be found in the Gallery of the post.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-images.png" alt="wp-images" title="wp-images" width="450" height="346" class="aligncenter size-full" /></p>
<h3>WordPress own functions for images</h3>
<p>One of the many options is <code>wp_get_attachment_image()</code>, which represents in my view, the simplest solution. Here is an example of what explains it in more detail.</p>
<p>At first we just get all pictures, not all the attachments of the posts that has been uploaded directly to the post. These images, we can directly display. The syntax must always be in the loop.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_parent'</span> <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachment_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The above example loads via the loop all images and display them. We don't take care about the actual size of the image, in default it will display the thumbnail. By setting <code>post_mime_type</code> = <code>image</code>, it only fetches images and not other attachments of the post.<br />
The function of WordPress, which outputs the image with HTML, requieres the ID of the attachment, so you have to retrieve the ID to the post beforehand, we'll do with <code>get_children()</code>.</p>
<p>A few words now to function <code>wp_get_attachment_image()</code> of WP to display the images. As already mentioned, there are several functions that all have a similar structure, and either give back other markup or allow other parameters. For a simple output, this function is best. It is also described in the <a href="http://codex.wordpress.org/Function_Reference/wp_get_attachment_image" class="liwp"> Codex</a>.</p>
<p>The function allows for 3 parameters:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Get an HTML img element representing an image attachment
 *
 * @param int $attachment_id Image attachment ID.
 * @param string $size Optional, default is 'thumbnail'.
 * @param bool $icon Optional, default is false. Whether it is an icon.
 * @return string HTML img element or empty string on failure.
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span><span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$size</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'thumbnail'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$icon</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>You get the markup back for the img-Tag, like the following example.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>mg width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;150&quot;</span> height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;150&quot;</span> src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://example.com/wp-content/uploads/2009/08/DSC00261-150x150.jpg&quot;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment-thumbnail2 alt=&quot;</span>Image Example<span style="color: #0000ff;">&quot; title=&quot;</span>Example Image<span style="color: #0000ff;">&quot; /&gt;</span></pre></div></div>

<p>The last of the three parameters is not really interesting in association with pictures, since it displays an icon. But the second parameter is there even more exciting, because this allows to set the size of the image. Here you can give either one of the preconfigured sizes, the sizes which you can configure in the settings of WordPress and are created when you upload using the media library. The following options are available.</p>
<ul>
<li>Default-Values: <code>thumbnail</code>, <code>medium</code>, <code>large</code> oder <code>full</code></li>
<li>Custom sizes via Array: array( width, height ) Example: <code>array(100, 100)</code></li>
</ul>
<p>If you pass your own values, then WordPress fetches the appropriate image in dependence of these values. So if you set, for example, 100x100 and the thumbnails are 150px150px, then these images are drawn. If you have your own array of 200x200, it will output the medium image because the thumbnail is too small.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_parent'</span> <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">250</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h4>Images with links</h4>
<p>Now I will not always just the pictures, but also have the image with a link to the image in original size. In that case there is the function <code>wp_get_attachment_link()</code>. Here an example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_parent'</span> <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'medium'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The HTML looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>a href<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://example.com/wp-content/uploads/2009/08/DSC00261.JPG&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Image&quot;</span><span style="color: #339933;">&gt;&lt;</span>img src<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://example.com/wp-content/uploads/2009/08/DSC00261-150x150.jpg&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;attachment-thumbnail&quot;</span> alt<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Image Example&quot;</span> title<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Example Image&quot;</span> height<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;150&quot;</span> width<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;150&quot;</span><span style="color: #339933;">/&gt;&lt;/</span>a<span style="color: #339933;">&gt;</span></pre></div></div>

<p>Thus the image in the requested size is generated, and the link was set to the image in original size.</p>
<h3>Determine size of the images</h3>
<p>Sometimes you want to know in advance how big is the image. There is a function that returns the values as an array. This is an example of the output:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_parent'</span> <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$src</span> <span style="color: #339933;">=</span> wp_get_attachment_image_src<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'full'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>This simple loop to output the values returns an array.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span>
  <span style="color: #cc66cc;">0</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'http://example.com/wp-content/uploads/2009/08/DSC00261.JPG'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">63</span><span style="color: #009900;">&#41;</span>
  <span style="color: #cc66cc;">1</span> <span style="color: #339933;">=&gt;</span> int <span style="color: #cc66cc;">1632</span>
  <span style="color: #cc66cc;">2</span> <span style="color: #339933;">=&gt;</span> int <span style="color: #cc66cc;">1224</span>
  <span style="color: #cc66cc;">3</span> <span style="color: #339933;">=&gt;</span> boolean <span style="color: #009900; font-weight: bold;">false</span></pre></div></div>

<p>The order of the array is allocated as follows.</p>
<ul>
<li>$src[0] => url</li>
<li>$src[1] => width</li>
<li>$src[2] => height</li>
<li>$src[3] => icon</li>
</ul>
<p>Thus, it can react to the size, depending on requirements. Alternatively, you can work with the function <code>image_get_intermediate_size($post_id, $size='thumbnail')</code>, which returns some more values. A sample of the output for 'medium':</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span>
  <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'DSC00261-300x225.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'300'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'225'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'path'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'2009/08/example-300x225.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">28</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'url'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'http://example.com/wp-content/uploads/2009/08/DSC00261-300x225.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">71</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h3>Further functions and possibilities</h3>
<p>In this context, there are a few other functions that enable the work with attachments or pictures. I do not want to explain each of them, therefore I constribute a small loop for testing purposes. This covers many possibilities and are self explanatory, I think.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'post_parent'</span> <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;p&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'wp_get_attachment_image: '</span> <span style="color: #339933;">.</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">200</span><span style="color: #339933;">,</span><span style="color: #cc66cc;">250</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'wp_get_attachment_link: '</span> <span style="color: #339933;">.</span> wp_get_attachment_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'wp_get_attachment_url: '</span> <span style="color: #339933;">.</span> wp_get_attachment_url<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'wp_get_attachment_thumb_url: '</span> <span style="color: #339933;">.</span> wp_get_attachment_thumb_url<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'get_attachment_link: '</span> <span style="color: #339933;">.</span> get_attachment_link<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$src</span> <span style="color: #339933;">=</span> image_get_intermediate_size<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'medium'</span>	 <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'image_get_intermediate_size. '</span><span style="color: #339933;">;</span> <span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$src</span> <span style="color: #339933;">=</span> wp_get_attachment_image_src<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'full'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'wp_get_attachment_image_src. '</span><span style="color: #339933;">;</span> <span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$src</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Title of attachment: '</span> <span style="color: #339933;">.</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'the_title'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$attachment</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_title</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Link to post: '</span> <span style="color: #339933;">.</span> get_permalink<span style="color: #009900;">&#40;</span><span style="color: #000088;">$image</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_parent</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;br /&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;hr style=&quot;clear:both;&quot; /&gt;&lt;/p&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Remember, the syntax must be in the loop of WordPress.</p>
<h4>Only one picture to post</h4>
<p>Now I have explained how to get the pictures but in general you will probably not need to post all the pictures, but you want just one picture. This occurs, for example, in magazine themes, where a small picture is displayed to make the post more interesting. Through these functions I can give the author of the respective post the control of that picture. Normally I do this in such a way that it explicitly output the first picture from the gallery to the post. Thus, the author can move the image in the gallery by dragging and dropping to the right place.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-gallery-reihenfolge.png" alt="wp-gallery-reihenfolge" title="wp-gallery-reihenfolge" width="450" height="375" class="aligncenter size-full wp-image-1739" /></p>
<p>This is not an own function, you just have to feed <code>get_children()</code> accordingly. The output of the image, and other values to the image is again as described above.</p>
<p>In our first example we pick <strong>only the first image</strong> from the gallery.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'post_parent'</span>    <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_type'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'numberposts'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// show all -1</span>
				<span style="color: #0000ff;">'post_status'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'inherit'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'orderby'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order ASC'</span>
				<span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> ?<span style="color: #339933;">&amp;&gt;</span></pre></div></div>

<p>Now the author of the contribution can always choose the first image of what he wants to use.</p>
<p>Alternatively we can turn the tables and get the <strong> last image from the Gallery </strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'post_parent'</span>    <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_type'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'numberposts'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// show all -1</span>
				<span style="color: #0000ff;">'post_status'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'inherit'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'DESC'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'orderby'</span>        <span style="color: #339933;">=&gt;</span><span style="color: #0000ff;">'menu_order ASC'</span>
				<span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>With the help of numberposts, we specify how many images are to be fetched. So we fetch in the following example the <strong>first 2 pics</strong> and after the <strong>last 2 pictures</strong>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'post_parent'</span>    <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_type'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'numberposts'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// show all -1</span>
				<span style="color: #0000ff;">'post_status'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'inherit'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'orderby'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order ASC'</span>
				<span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>Well, the <strong>last two pictures</strong>, starting with the last picture.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'post_parent'</span>    <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_type'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'numberposts'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">2</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// show all -1</span>
				<span style="color: #0000ff;">'post_status'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'inherit'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'DESC'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'orderby'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order ASC'</span>
				<span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<h3>Meta-Data of images</h3>
<p>WordPress saves various meta data to the images. Now and then these are very useful, and why not simply use them.</p>
<p>First an example to get to the data. This we do with the function <code>wp_get_attachment_metadata()</code>. This function returns quite a lot of data and we can access the size of images, their path and also access the meta data.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$attachments</span> <span style="color: #339933;">=</span> get_children<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
				<span style="color: #0000ff;">'post_parent'</span>    <span style="color: #339933;">=&gt;</span> get_the_ID<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_type'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'attachment'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'numberposts'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">1</span><span style="color: #339933;">,</span> <span style="color: #666666; font-style: italic;">// show all -1</span>
				<span style="color: #0000ff;">'post_status'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'inherit'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'post_mime_type'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'order'</span>          <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'ASC'</span><span style="color: #339933;">,</span>
				<span style="color: #0000ff;">'orderby'</span>        <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'menu_order ASC'</span>
				<span style="color: #009900;">&#41;</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;">$attachments</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #339933;">=&gt;;</span> <span style="color: #000088;">$attachment</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> wp_get_attachment_image<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$imagemeta</span> <span style="color: #339933;">=</span> wp_get_attachment_metadata<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$attachment_id</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// list values in array</span>
&nbsp;
	<span style="color: #000088;">$aperture</span>          <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'aperture'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$credit</span>            <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'credit'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$camera</span>            <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'camera'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$caption</span>           <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'caption'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$created_timestamp</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'created_timestamp'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$copyright</span>         <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'copyright'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$focal_length</span>      <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'focal_length'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$iso</span>               <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'iso'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$shutter_speed</span>     <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'shutter_speed'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
	<span style="color: #000088;">$title</span>             <span style="color: #339933;">=</span> <span style="color: #000088;">$imagemeta</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'image_meta'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'title'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>In the above code is the output value of a <code>var_dump()</code> in it. Thus we see very quickly which content in the array exists and where they can be accessed.<br />
All values of the meta data, I have written in each variable, so that even less experienced users should understand it.</p>
<p>For a simple picture, of what would be created via cell phone camera, for example, the array looks like this.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #990000;">array</span>
  <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'1632'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'1224'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'hwstring_small'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'height='</span><span style="color: #cc66cc;">96</span><span style="color: #0000ff;">' width='</span><span style="color: #cc66cc;">128</span><span style="color: #0000ff;">''</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">23</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'2009/08/DSC00261.JPG'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'sizes'</span> <span style="color: #339933;">=&gt;</span>
    <span style="color: #990000;">array</span>
      <span style="color: #0000ff;">'thumbnail'</span> <span style="color: #339933;">=&gt;</span>
        <span style="color: #990000;">array</span>
          <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'DSC00261-150x150.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'150'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'150'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'medium'</span> <span style="color: #339933;">=&gt;</span>
        <span style="color: #990000;">array</span>
          <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'DSC00261-300x225.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">20</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'300'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'225'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'large'</span> <span style="color: #339933;">=&gt;</span> 
        <span style="color: #990000;">array</span>
          <span style="color: #0000ff;">'file'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'DSC00261-1024x768.jpg'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">21</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'width'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'1024'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">4</span><span style="color: #009900;">&#41;</span>
          <span style="color: #0000ff;">'height'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'768'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
  <span style="color: #0000ff;">'image_meta'</span> <span style="color: #339933;">=&gt;</span> 
    <span style="color: #990000;">array</span>
      <span style="color: #0000ff;">'aperture'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'2.8'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'credit'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'camera'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'W800i'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">5</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'caption'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'created_timestamp'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'1184253323'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">10</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'copyright'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'focal_length'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'0'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'iso'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'100'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">3</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'shutter_speed'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">'0.0166666666667'</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">15</span><span style="color: #009900;">&#41;</span>
      <span style="color: #0000ff;">'title'</span> <span style="color: #339933;">=&gt;</span> string <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#40;</span>length<span style="color: #339933;">=</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span></pre></div></div>

<h3>Alternative in WordPress 2.9</h3>
<p>Using WordPress version 2.9, there is a template tag just for this request, so it is easier and more understandable. You just use the <code>the_post_image()</code> and you can set the size. Default is <code>thumbnail</code>, it is possible <code>thumbnail</code>, <code>medium</code>, <code>large</code> or <code>full</code>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">the_post_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// without parameter -&gt; Thumbnail</span>
the_post_image<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Thumbnail</span>
the_post_image<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'medium'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Medium resolution - use full,</span></pre></div></div>

<p>As a small alternative is still <code>get_the_post_image()</code> available, whereas the function doesn't have echo, and can optionally have the ID of the post.<br />
<code>get_the_post_image( $size = 'thumbnail', $post_id = NULL )</code></p>
<h3>Conclusion</h3>
<p>WordPress offers a lot of different functions to access attachments, whether pictures or other files. Also a part of meta-data is stored, which can be used. Many approaches can be found in the code, primarily in the <code>wp-includes/media.php</code>. Perhaps I could point out some solutions which in my view a better alternative than the use of custom fields, or even scanning the content.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/" rel="bookmark" title="Permanent Link: WordPress 2.9 add_theme_support and has_post_image" class="liinternal">WordPress 2.9 add_theme_support and has_post_image</a></li>
<li><a href="http://wpengineer.com/correct-pagination-with-get_posts/" rel="bookmark" title="Permanent Link: Correct Pagination with get_posts" class="liinternal">Correct Pagination with get_posts</a></li>
<li><a href="http://wpengineer.com/strange-things-with-sticky-posts/" rel="bookmark" title="Permanent Link: Strange Things With Sticky Posts" class="liinternal">Strange Things With Sticky Posts</a></li>
<li><a href="http://wpengineer.com/wordpress-27-optimize-the-management/" rel="bookmark" title="Permanent Link: WordPress 2.7 Optimize The Management" class="liinternal">WordPress 2.7 Optimize The Management</a></li>
<li><a href="http://wpengineer.com/wordpress-category-exists/" rel="bookmark" title="Permanent Link: WordPress Category Exists?" class="liinternal">WordPress Category Exists?</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		</item>
		<item>
		<title>New feature in WordPress 2.9 – the_post_image()</title>
		<link>http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/</link>
		<comments>http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 23:08:42 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[template_tag]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1750</guid>
		<description><![CDATA[In WordPress 2.9, there will be the ability to add an image to a post, as it's been known of magazine themes. The image need not be insert into the post. With the new feature the_post_image() you can use the new feature and thus control where to display.

The two screenshots show the new post thumbnail [...]]]></description>
			<content:encoded><![CDATA[<p>In WordPress 2.9, there will be the ability to add an image to a post, as it's been known of magazine themes. The image need not be insert into the post. With the new feature <strong>the_post_image()</strong> you can use the new feature and thus control where to display.<br />
<span id="more-1750"></span></p>
<p>The two screenshots show the new post thumbnail dialog when creating a new article. Here you set the picture.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/post-thumbnail-small.jpg" alt="New Dialog Post Thumbnail" title="New Dialog Post Thumbnail" width="290" height="72" class="aligncenter size-full wp-image-1752" /></p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/post-thumbnail.jpg" alt="Post Thumbnail Dialog" title="Post Thumbnail Dialog" width="300" height="200" class="aligncenter size-full wp-image-1751" /></p>
<p>In the template you can use the function <strong>the_post_image()</strong> to place the image. Here's an example:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">&lt;div class=&quot;entry&quot;&gt;
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_post_image<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>
    <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Read the rest of this entry &amp;raquo;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&lt;/div&gt;</pre></div></div>

<p>You can also determine what resolution you want to display.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">the_post_image<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// without parameter -&gt; Thumbnail</span>
the_post_image<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'thumbnail'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Thumbnail</span>
the_post_image<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'medium'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Medium resolution</span></pre></div></div>

<p>Unfortunately, the developers haven't implemented a way to align the image with the classes <code>alignleft, alignright and aligncenter</code>. And this is how it looks like with the default theme of Wordpress:</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/post-thumbnail-example.jpg" alt="Example of the new function the_post_image" title="Example of the new function the_post_image" width="486" height="253" class="aligncenter size-full wp-image-1753" /><br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/" rel="bookmark" title="Permanent Link: WordPress 2.9 add_theme_support and has_post_image" class="liinternal">WordPress 2.9 add_theme_support and has_post_image</a></li>
<li><a href="http://wpengineer.com/wordpress-28-feature-password/" rel="bookmark" title="Permanent Link: WordPress 2.8 Feature Password" class="liinternal">WordPress 2.8 Feature Password</a></li>
<li><a href="http://wpengineer.com/disable-wordpress-feed/" rel="bookmark" title="Permanent Link: Disable WordPress Feed" class="liinternal">Disable WordPress Feed</a></li>
<li><a href="http://wpengineer.com/identify-authors-gravatars/" rel="bookmark" title="Permanent Link: Identify Authors With Gravatars" class="liinternal">Identify Authors With Gravatars</a></li>
<li><a href="http://wpengineer.com/easier-better-solutions-to-get-pictures-on-your-posts/" rel="bookmark" title="Permanent Link: Easier And Better Solutions To Get Pictures On Your Posts" class="liinternal">Easier And Better Solutions To Get Pictures On Your Posts</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/feed/</wfw:commentRss>
		<slash:comments>42</slash:comments>
		</item>
		<item>
		<title>WordPress Database Functions</title>
		<link>http://wpengineer.com/wordpress-database-functions/</link>
		<comments>http://wpengineer.com/wordpress-database-functions/#comments</comments>
		<pubDate>Mon, 12 Oct 2009 13:21:45 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1746</guid>
		<description><![CDATA[The WordPress database class is quite extensive and provides a range of methods to work effectively with the database and thereby use the WordPress standard.
You can find the class in /wp-includes/wp-db.php where the individual methods are documented.
I show the most important ones and give some small examples. It is important to work with these opportunities [...]]]></description>
			<content:encoded><![CDATA[<p>The WordPress database class is quite extensive and provides a range of methods to work effectively with the database and thereby use the WordPress standard.</p>
<p>You can find the class in <code>/wp-includes/wp-db.php</code> where the individual methods are documented.<br />
I show the most important ones and give some small examples. It is important to work with these opportunities to ensure the safety of Plugins.</p>
<p><span id="more-1746"></span><br />
For the following four methods I created some syntax examples.</p>
<ul>
<li><code>insert($table, $data, $format)</code> — insert a row into a table via arrays.</li>
<li><code>update($table, $data, $where, $format, $where_format)</code> — update a row in a table via arrays.</li>
<li><code>get_var($query, $x, $y)</code> — retrieve a single variable from the database.</li>
<li><code>query($query)</code> — perform a MySQL database query with current connection</li>
<li><code>get_results($query, $output)</code> — retrieve SQL result set from database… one or more rows.</li>
<li><code>escape($data)</code> — Escapes content for insertion into the database using addslashes(), for security</li>
</ul>
<p>Also interesting are the methods below.</p>
<ul>
<li><code>set_prefix($prefix)</code> — used to set table prefix for WordPress tables, can be used to override prefix at any time</li>
<li><code>prepare($query)</code> — safely prepares an SQL query for execution with sprintf()-like syntax.</li>
<li><code>get_row($query, $output, $y)</code> — retrieve a single row from the database.</li>
<li><code>get_col($query, $x)</code> — retrieve a single column from the database in array format.</li>
</ul>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * insert
 */</span>
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">posts</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$mytitle</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">insert</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">options</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
            <span style="color: #0000ff;">'option_name'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'new_option_key'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'option_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'New Option Value'</span><span style="color: #339933;">,</span>
            <span style="color: #0000ff;">'autoload'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'yes'</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * update
 */</span>
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">posts</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'post_title'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$mytitle</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'ID'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$myid</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">update</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">options</span><span style="color: #339933;">,</span>
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'option_value'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'New Option Value'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
            <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'option_name'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'new_option_value'</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * get_var
 */</span>
<span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span>
            <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;SELECT post_id FROM
                    <span style="color: #006699; font-weight: bold;">$wpdb-&gt;postmeta</span> WHERE
                    post_id = <span style="color: #009933; font-weight: bold;">%d</span> AND
                    meta_key = 'enclosure' AND
                    meta_value LIKE (<span style="color: #009933; font-weight: bold;">%s</span>)&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;'</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_var</span><span style="color: #009900;">&#40;</span>
            <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">prepare</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;SELECT post_content FROM &quot;</span> <span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE &quot;</span> <span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">&quot;post_title = <span style="color: #009933; font-weight: bold;">%s</span> AND &quot;</span> <span style="color: #339933;">.</span>
                    <span style="color: #0000ff;">&quot;ID = <span style="color: #009933; font-weight: bold;">%d</span>&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$title</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * query
 */</span>
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;DELETE FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;options</span> WHERE option_name = '<span style="color: #006699; font-weight: bold;">$name</span>'&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;UPDATE <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> SET post_title = '<span style="color: #006699; font-weight: bold;">$mytitle</span>' WHERE ID = <span style="color: #006699; font-weight: bold;">$myid</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * query and escape
 */</span>
<span style="color: #000088;">$mytitle</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">escape</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$mytitle</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$myid</span>    <span style="color: #339933;">=</span> absint<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$myid</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;UPDATE <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> SET post_title = '<span style="color: #006699; font-weight: bold;">$mytitle</span>' WHERE ID = <span style="color: #006699; font-weight: bold;">$myid</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * get_results
 */</span>
<span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$wpdb</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_results</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;SELECT post_type FROM &quot;</span> <span style="color: #339933;">.</span>
                <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span> WHERE ID=<span style="color: #006699; font-weight: bold;">$id</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/some-more-details-about-the-wp-sytem-health-plugin/" rel="bookmark" title="Permanent Link: Some More Details About The WP System Health Plugin" class="liinternal">Some More Details About The WP System Health Plugin</a></li>
<li><a href="http://wpengineer.com/wordpress-working-with-options/" rel="bookmark" title="Permanent Link: WordPress: Working With Options" class="liinternal">WordPress: Working With Options</a></li>
<li><a href="http://wpengineer.com/list-all-users-in-wordpress/" rel="bookmark" title="Permanent Link: List All Users in WordPress" class="liinternal">List All Users in WordPress</a></li>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
<li><a href="http://wpengineer.com/wordpress-plugin-deinstall-data-automatically/" rel="bookmark" title="Permanent Link: WordPress Plugin Deinstall Data Automatically" class="liinternal">WordPress Plugin Deinstall Data Automatically</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-database-functions/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>WordPress Searchform, Template Tag or Template</title>
		<link>http://wpengineer.com/wordpress-searchform-template-tag-or-template/</link>
		<comments>http://wpengineer.com/wordpress-searchform-template-tag-or-template/#comments</comments>
		<pubDate>Mon, 05 Oct 2009 11:27:47 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[template tag]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1716</guid>
		<description><![CDATA[There are several ways to integrate search function into a theme for WordPresss, usually built in a template, which is included into the theme. This is not in all cases necessary and can also be realized by using a WordPress template tag.

WordPress provides a function that allows an easy way to use the search form: [...]]]></description>
			<content:encoded><![CDATA[<p>There are several ways to integrate search function into a theme for WordPresss, usually built in a template, which is included into the theme. This is not in all cases necessary and can also be realized by using a WordPress template tag.<br />
<span id="more-1716"></span></p>
<p>WordPress provides a function that allows an easy way to use the search form: <code>get_search_form()</code>. It's similar to <code>get_sidebar()</code> or <code>get_header()</code> which is in use in most of the themes. The function is available since WordPress version 2.7 and is found in <code>wp-includes/general-template.php</code>.</p>
<h4>HTML-Result</h4>
<p>The output without changing the function looks like this in HTML.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>form role<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;search&quot;</span> method<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;get&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;searchform&quot;</span> action<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;http://example.com/&quot;</span><span style="color: #339933;">&gt;</span>
    <span style="color: #339933;">&lt;</span>div<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>label <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;screen-reader-text&quot;</span> <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;s&quot;</span><span style="color: #339933;">&gt;</span><span style="color: #0000ff;">' . __('</span>Search <span style="color: #b1b100;">for</span><span style="color: #339933;">:</span><span style="color: #0000ff;">') . '</span><span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span>
        <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;text&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;s&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;s&quot;</span> <span style="color: #339933;">/&gt;</span>
        <span style="color: #339933;">&lt;</span>input type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;submit&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;searchsubmit&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;Suche&quot;</span> <span style="color: #339933;">/&gt;</span>
    <span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>form<span style="color: #339933;">&gt;</span></pre></div></div>

<h4>Content in input field</h4>
<p>Now, the function provides a hook to influence the search field. In this example, the text will be affected in the search box, so that the user finds an info there.<br />
This is realized through a filter hook <code>the_search_query</code>. Within the function that is passed to this hook is also ascertained whether there is a value already in the field and if this is not the default value, but the returned value of the search. Then the value will left unchanged.<br />
This function belongs in <code>functions.php</code> of the themes and can of course be adapted to your needs.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> fb_get_search_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> <span style="color: #990000;">stripslashes</span><span style="color: #009900;">&#40;</span> get_query_var<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'s'</span> <span style="color: #009900;">&#41;</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: #000088;">$return</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Type in your search keyword...'</span><span style="color: #339933;">,</span> FB_BASIS_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">else</span>
		<span style="color: #000088;">$return</span> <span style="color: #339933;">=</span> apply_filters<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'get_search_query'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$return</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'the_search_query'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_get_search_query'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Search field and special needs</h4>
<p>The search form may not always be as you want it and therefore it makes sense to create a custom search field. Still offering the possibility of WordPress, it makes sense of a function or template called <code>searchform.php</code>, see <a href="#searchform" class="liinternal">more info</a> further down, to integrate into the theme and provide the hooks with. Therefore Plugins can access the search form. A short example which includes a small JavaScript function.</p>
<p>First the function for <code>functions.php</code> of the theme.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> fb_get_search_form<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    do_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'get_search_form'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000088;">$form</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;form method=&quot;get&quot; id=&quot;searchform&quot; action=&quot;'</span> <span style="color: #339933;">.</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'home'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/&quot; &gt;
    &lt;div&gt;&lt;label class=&quot;screen-reader-text&quot; for=&quot;s&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Search for:'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/label&gt;
    &lt;input type=&quot;text&quot; value=&quot;'</span> <span style="color: #339933;">.</span> esc_attr<span style="color: #009900;">&#40;</span>apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_search_query'</span><span style="color: #339933;">,</span> get_search_query<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; name=&quot;s&quot; id=&quot;s&quot; onfocus=&quot;clearSearch();&quot; /&gt;
    &lt;input type=&quot;submit&quot; id=&quot;searchsubmit&quot; value=&quot;'</span><span style="color: #339933;">.</span> esc_attr__<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Search'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;
    &lt;/div&gt;
    &lt;/form&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'get_search_form'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$form</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>The function already contains the above-mentioned hook <code>the_search_query</code>, and also the extension of the JavaScript <code>onfocus="clearSearch();"</code>. This little function does ensure that the content of the search field is cleared when you click in the box. It only deletes the content if the content is <em>Type in your search keyword...</em>.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> clearSearch<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	queryBox <span style="color: #339933;">=</span> document<span style="color: #339933;">.</span>getElementById<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> queryBox<span style="color: #339933;">.</span>value <span style="color: #339933;">==</span> <span style="color: #0000ff;">'Type in your search keyword...'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		queryBox<span style="color: #339933;">.</span>value <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
	queryBox<span style="color: #339933;">.</span>style<span style="color: #339933;">.</span>color <span style="color: #339933;">=</span> <span style="color: #0000ff;">'#292929'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>This little script is stored in a file and is also loaded from the <code>functions.php</code> of the theme. This serves the following call, for further information about <code>wp_enqueue_script</code> you can go to <a href="http://wpengineer.com/use-javascript-libraries-in-and-of-wordpress/" class="liinternal">http://wpengineer.com/use-javascript-libraries-in-and-of-wordpress/</a>.<br />
<code>wp_enqueue_script( 'fb_scripts', get_bloginfo('template_directory') . '/js/script.js', '', '', true );<br />
</code></p>
<h4 id="searchform">Template searchform.php</h4>
<p>Of course, you are still be able to create an extra template for the search form. WordPress is looking for a template <code>searchform.php</code> in your theme. WordPress is looking in the first step for this template, if this is not found, since version 2.7 of WordPress, the form from the template tag <code>get_search_form()</code> get used.</p>
<p>Which way you go, that's for sure depending on the working methods and habits, but there is a template tag available and it can save a template.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-28-body_class-automatic_feed_links/" rel="bookmark" title="Permanent Link: WordPress 2.8 body_class, automatic_feed_links" class="liinternal">WordPress 2.8 body_class, automatic_feed_links</a></li>
<li><a href="http://wpengineer.com/change-your-wordpress-theme-on/" rel="bookmark" title="Permanent Link: Change your WordPress Theme on Dependency" class="liinternal">Change your WordPress Theme on Dependency</a></li>
<li><a href="http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/" rel="bookmark" title="Permanent Link: WordPress 2.9 add_theme_support and has_post_image" class="liinternal">WordPress 2.9 add_theme_support and has_post_image</a></li>
<li><a href="http://wpengineer.com/expand-search-results-in-wordpress/" rel="bookmark" title="Permanent Link: Expand Search Results In WordPress" class="liinternal">Expand Search Results In WordPress</a></li>
<li><a href="http://wpengineer.com/find-wordpress-functions-template-tags-and-more-with-wpseek/" rel="bookmark" title="Permanent Link: Find WordPress Functions, Template Tags And More With WPSeek!" class="liinternal">Find WordPress Functions, Template Tags And More With WPSeek!</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-searchform-template-tag-or-template/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Filter Duplicate Posts in the Loop</title>
		<link>http://wpengineer.com/filter-duplicate-posts-in-the-loop/</link>
		<comments>http://wpengineer.com/filter-duplicate-posts-in-the-loop/#comments</comments>
		<pubDate>Mon, 28 Sep 2009 19:16:56 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[Loop]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[template tag]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1719</guid>
		<description><![CDATA[As the question arises quite often I'd like to show how I make sure that the content presented, which were output in a loop, not showed up again in a second loop.

WordPress identifies posts and pages via ID, which are created in the database and who also play in the output of the loop a [...]]]></description>
			<content:encoded><![CDATA[<p>As the question arises quite often I'd like to show how I make sure that the content presented, which were output in a loop, not showed up again in a second loop.<br />
<span id="more-1719"></span><br />
WordPress identifies posts and pages via ID, which are created in the database and who also play in the output of the loop a crucial role. All assignments or links based on the ID. Therefore, I save in the first loop (<em>Loop No.1 </em>) the IDs, which will be output, in an array. This variable was determined in advance as an array <code>$do_not_duplicate = array();</code>.</p>
<h4>Loop no.1</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #000088;">$do_not_duplicate</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// set befor loop variable as array</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// 1. Loop</span>
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ca=1,2,3&amp;showposts=5'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #000088;">$do_not_duplicate</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// remember ID's in loop</span>
    <span style="color: #666666; font-style: italic;">// display post ...</span>
    the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>After we output the above loop with 5 articles, we have in the array 5 IDs, which we can use now . You can view the array with the PHP-function <code><a href="http://de2.php.net/manual/de/function.var-dump.php" class="liexternal">var_dump()</a></code>.</p>
<p>In the next loop no. 2 there should be 15 articles displayed, except the articles with the ID's already appearing in loop no. 1. I check with this function <code><a href="http://de2.php.net/manual/de/function.in-array.php" class="liexternal">in_array()</a></code>,<br />
if the current ID <code>$post-&gt;ID</code> is already existing in the array <code>$do_not_duplicate</code>. Only if the ID is not existing ( <code>!in_array()</code> ) in the array, then it will be displayed in loop no. 2.</p>
<h4>Loop no.2</h4>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// 2. Loop</span>
query_posts<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'cat=4,5,6&amp;showposts=15'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span>have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</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: #339933;">!</span><span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #000088;">$do_not_duplicate</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span> <span style="color: #666666; font-style: italic;">// check IDs         </span>
<span style="color: #666666; font-style: italic;">// display posts ...</span>
        the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>But there is also an alternative, WordPress has a parameter in the query available - <code>post__not_in</code>, see <a href="http://codex.wordpress.org/Template_Tags/query_posts#Post_.26_Page_Parameters" class="liwp">Codex</a>.<br />
Also in this parameter, I use an array and in this query are the IDs not included. Depending on which way you go, are thus provides two different syntax, to avoid duplicate content.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #666666; font-style: italic;">// another loop without duplicates</span>
query_posts<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'cat'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">456</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'post__not_in'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$do_not_duplicate</span>
    <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">while</span> <span style="color: #009900;">&#40;</span> have_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> the_post<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #666666; font-style: italic;">// display posts...</span>
        the_title<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">endwhile</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/expand-search-results-in-wordpress/" rel="bookmark" title="Permanent Link: Expand Search Results In WordPress" class="liinternal">Expand Search Results In WordPress</a></li>
<li><a href="http://wpengineer.com/quick-tipps-for-wordpress-query/" rel="bookmark" title="Permanent Link: Quick Tipps For WordPress Query" class="liinternal">Quick Tipps For WordPress Query</a></li>
<li><a href="http://wpengineer.com/exclude-subcategories-in-a-loop/" rel="bookmark" title="Permanent Link: Exclude Subcategories in a Loop" class="liinternal">Exclude Subcategories in a Loop</a></li>
<li><a href="http://wpengineer.com/correct-pagination-with-get_posts/" rel="bookmark" title="Permanent Link: Correct Pagination with get_posts" class="liinternal">Correct Pagination with get_posts</a></li>
<li><a href="http://wpengineer.com/strange-things-with-sticky-posts/" rel="bookmark" title="Permanent Link: Strange Things With Sticky Posts" class="liinternal">Strange Things With Sticky Posts</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/filter-duplicate-posts-in-the-loop/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Set options on activation Themes</title>
		<link>http://wpengineer.com/set-options-on-activation-themes/</link>
		<comments>http://wpengineer.com/set-options-on-activation-themes/#comments</comments>
		<pubDate>Mon, 21 Sep 2009 10:09:56 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[The]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1705</guid>
		<description><![CDATA[The Photo Blog Theme  Greyfoto  has been updated and I wanted to make sure that the settings of WordPress are as I need them for the theme. Therefore must be written some data in the database when activate. Currently there is no hook for this, as is known for Plugins. The discussion on [...]]]></description>
			<content:encoded><![CDATA[<p>The Photo Blog Theme <a href="http://bueltge.de/photoblog-theme-greyfoto/837/" class="liexternal"> Greyfoto </a> has been updated and I wanted to make sure that the settings of WordPress are as I need them for the theme. Therefore must be written some data in the database when activate. Currently there is no hook for this, as is known for Plugins. The discussion on <a href="http://www.nabble.com/Activation-hook-exist-for-themes--to25211004.html" class="liexternal">WP-Hacker-List</a> was just right on time, and possibly Theme Developers get these hooks, similar to Plugins in WordPress 2.9.</p>
<p>If you want to use the activation of the theme in order to set various settings, then the following snippet can be very useful, which came up in the discussion on the WP-Hacker-List. This works like a charm and should be useful for theme developers who want to enable the options upon activation.<br />
<span id="more-1705"></span><br />
Here's a small example in which the default setting <code>posts_per_page</code> of WordPress in the table <code>options</code> is reset to the value 1.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// with activate istall option</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'activated'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$pagenow</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'themes.php'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	update_option<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'posts_per_page'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-working-with-options/" rel="bookmark" title="Permanent Link: WordPress: Working With Options" class="liinternal">WordPress: Working With Options</a></li>
<li><a href="http://wpengineer.com/wordpress-ftp-data-with-constant/" rel="bookmark" title="Permanent Link: WordPress FTP Data With Constant" class="liinternal">WordPress FTP Data With Constant</a></li>
<li><a href="http://wpengineer.com/wordpress-28-widgets-options-page/" rel="bookmark" title="Permanent Link: WordPress 2.8 Widgets Options Page &#8211; First Screenshot!" class="liinternal">WordPress 2.8 Widgets Options Page &#8211; First Screenshot!</a></li>
<li><a href="http://wpengineer.com/improve-seo-in-wordpress-with-the-wpseo-wordpress-plugin/" rel="bookmark" title="Permanent Link: Improve SEO In WordPress With The wpSEO WordPress Plugin" class="liinternal">Improve SEO In WordPress With The wpSEO WordPress Plugin</a></li>
<li><a href="http://wpengineer.com/wplize-a-class-for-options-in-wordpress/" rel="bookmark" title="Permanent Link: WPlize &#8211; A Class For Options In WordPress" class="liinternal">WPlize &#8211; A Class For Options In WordPress</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/set-options-on-activation-themes/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Add File Types for Mediathek</title>
		<link>http://wpengineer.com/add-file-types-for-mediathek/</link>
		<comments>http://wpengineer.com/add-file-types-for-mediathek/#comments</comments>
		<pubDate>Fri, 18 Sep 2009 08:54:41 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[security]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress 2.8]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1668</guid>
		<description><![CDATA[In WordPress 2.8.5 the whitelist of allowed MIME types for downloads will be valid for administrators the first time. This is a step towards security and you can, with the help of a constant, upload all data types.
define ( 'ALLOW_UNFILTERED_UPLOADS', true);
Who has implemented several projects already with WordPress probably had experienced that a user doesn't [...]]]></description>
			<content:encoded><![CDATA[<p>In WordPress 2.8.5 the whitelist of allowed MIME types for downloads will be valid for administrators the first time. This is a step towards security and you can, with the help of a constant, upload all data types.<br />
<code>define ( 'ALLOW_UNFILTERED_UPLOADS', true);</code></p>
<p>Who has implemented several projects already with WordPress probably had experienced that a user doesn't have the rights to upload a specific format.</p>
<p>The Plugin <a href="http://www.im-web-gefunden.de/wordpress-plugins/role-manager/" class="liexternal">Role Manager</a> allows the uploading of all MIME types. But in my opinion this is not the perfect way, and therefore here is a small code snippet that takes adjusting according to the particular requirement.<br />
<span id="more-1668"></span><br />
<a href="http://wpengineer.com/blog/wp-content/uploads/upload-filter.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/upload-filter.png" alt="upload-filter" title="upload-filter" width="439" height="346" class="aligncenter size-full wp-image-1670" /></a></p>
<p>All allowed types are found in the whitelist-function <code>wp_check_filetype()</code>, in <code> wp-includes/functions.php</code>.<br />
This function has a filter <code>upload_mimes</code> that can be extended. And there we come in and call the MIME types that we need. In the following example, I allow PHP-, XHTML- and htaccess-files. The options are passed in an array and the assignment is important so that WordPress can also assign an icon, like you see on the screenshot.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> my_upload_mimes<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$mime_types</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span> 
		<span style="color: #0000ff;">'php|phps'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/php'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'xhtm|xhtml'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
		<span style="color: #0000ff;">'htaccess'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/plain'</span>
	<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$mime_types</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'upload_mimes'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_upload_mimes'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<h4>Mime Types</h4>
<p>To obtain a list of all MIME types that can be used, you can check out the following list. The list should only contain type files, which are explicitly required,  otherwise the above constants can be used.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$mime_types</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
<span style="color: #0000ff;">'323'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/h323'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'acx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/internet-property-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ai'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'aif'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'aifc'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'aiff'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-aiff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'asf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-ms-asf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'asr'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-ms-asf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'asx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-ms-asf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'au'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/basic'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'avi'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-msvideo'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'axs'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/olescript'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bas'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bcpio'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-bcpio'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bin'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'bmp'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/bmp'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'c'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cat'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-pkiseccat'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cdf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-cdf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cer'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-x509-ca-cert'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'class'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'clp'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msclip'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cmx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-cmx'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cod'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/cis-cod'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'cpio'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-cpio'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'crd'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-mscardfile'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'crl'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/pkix-crl'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'crt'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-x509-ca-cert'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'csh'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-csh'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'css'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/css'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dcr'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'der'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-x509-ca-cert'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dir'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dll'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msdownload'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dms'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'doc'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/msword'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dot'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/msword'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dvi'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-dvi'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'dxr'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-director'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'eps'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'etx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/x-setext'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'evy'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/envoy'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'exe'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'fif'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/fractals'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'flr'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'gif'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/gif'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'gtar'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-gtar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'gz'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-gzip'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'h'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'hdf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-hdf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'hlp'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/winhlp'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'hqx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/mac-binhex40'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'hta'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/hta'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'htc'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/x-component'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'htm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'html'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'htt'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/webviewhtml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ico'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-icon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ief'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/ief'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'iii'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-iphone'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ins'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-internet-signup'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'isp'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-internet-signup'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'jfif'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/pipeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'jpe'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'jpeg'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'jpg'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/jpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'js'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-javascript'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'latex'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-latex'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'lha'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'lsf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-la-asf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'lsx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-la-asf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'lzh'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/octet-stream'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'m13'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msmediaview'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'m14'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msmediaview'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'m3u'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-mpegurl'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'man'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff-man'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mdb'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msaccess'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'me'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff-me'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mht'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'message/rfc822'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mhtml'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'message/rfc822'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mid'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/mid'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mny'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msmoney'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mov'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/quicktime'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'movie'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/x-sgi-movie'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mp2'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mp3'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpa'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpe'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpeg'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpg'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpp'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-project'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mpv2'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/mpeg'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ms'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff-ms'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'mvb'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msmediaview'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'nws'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'message/rfc822'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'oda'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/oda'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p10'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/pkcs10'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p12'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs12'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p7b'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-certificates'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p7c'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-mime'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p7m'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-mime'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p7r'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-certreqresp'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'p7s'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-signature'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pbm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-portable-bitmap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pdf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/pdf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pfx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs12'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pgm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-portable-graymap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pko'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/ynd.ms-pkipko'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pma'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-perfmon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pmc'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-perfmon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pml'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-perfmon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pmr'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-perfmon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pmw'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-perfmon'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pnm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-portable-anymap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pot'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-powerpoint'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ppm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-portable-pixmap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pps'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-powerpoint'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ppt'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-powerpoint'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'prf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/pics-rules'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ps'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/postscript'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'pub'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-mspublisher'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'qt'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'video/quicktime'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ra'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-pn-realaudio'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ram'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-pn-realaudio'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ras'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-cmu-raster'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'rgb'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-rgb'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'rmi'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/mid'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'roff'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'rtf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/rtf'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'rtx'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/richtext'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'scd'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msschedule'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sct'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/scriptlet'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'setpay'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/set-payment-initiation'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'setreg'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/set-registration-initiation'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sh'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-sh'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'shar'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-shar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sit'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-stuffit'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'snd'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/basic'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'spc'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-pkcs7-certificates'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'spl'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/futuresplash'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'src'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-wais-source'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sst'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-pkicertstore'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'stl'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-pkistl'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'stm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/html'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'svg'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/svg+xml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sv4cpio'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-sv4cpio'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'sv4crc'</span>  <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-sv4crc'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'t'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tar'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-tar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tcl'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-tcl'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tex'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-tex'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'texi'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-texinfo'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'texinfo'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-texinfo'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tgz'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-compressed'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tif'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/tiff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tiff'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/tiff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tr'</span>      <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-troff'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'trm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msterminal'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'tsv'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/tab-separated-values'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'txt'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/plain'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'uls'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/iuls'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'ustar'</span>   <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-ustar'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'vcf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'text/x-vcard'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'vrml'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wav'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'audio/x-wav'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wcm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-works'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wdb'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-works'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wks'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-works'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wmf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-msmetafile'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wps'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-works'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wri'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-mswrite'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wrl'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'wrz'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xaf'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xbm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-xbitmap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xla'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xlc'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xlm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xls'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xlt'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xlw'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/vnd.ms-excel'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xof'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'x-world/x-vrml'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xpm'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-xpixmap'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'xwd'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'image/x-xwindowdump'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'z'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/x-compress'</span><span style="color: #339933;">,</span>
<span style="color: #0000ff;">'zip'</span>     <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'application/zip'</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-plugin-readme-file-generator/" rel="bookmark" title="Permanent Link: WordPress Plugin Readme File Generator" class="liinternal">WordPress Plugin Readme File Generator</a></li>
<li><a href="http://wpengineer.com/how-core-update-in-wordpress-27-works/" rel="bookmark" title="Permanent Link: How Core Update in WordPress 2.7 Works?" class="liinternal">How Core Update in WordPress 2.7 Works?</a></li>
<li><a href="http://wpengineer.com/my-hacksphp/" rel="bookmark" title="Permanent Link: Bye Bye my-hacks.php?" class="liinternal">Bye Bye my-hacks.php?</a></li>
<li><a href="http://wpengineer.com/embed-wordpress-functions-outside-wordpress/" rel="bookmark" title="Permanent Link: Embed WordPress Functions Outside WordPress" class="liinternal">Embed WordPress Functions Outside WordPress</a></li>
<li><a href="http://wpengineer.com/plugin-review-codestyling-localization/" rel="bookmark" title="Permanent Link: Plugin Review: Codestyling Localization" class="liinternal">Plugin Review: Codestyling Localization</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/add-file-types-for-mediathek/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>New Feature for WordPress 2.9 – WordPress Image Editor</title>
		<link>http://wpengineer.com/new-feature-for-wordpress-2-9-wordpress-image-editor/</link>
		<comments>http://wpengineer.com/new-feature-for-wordpress-2-9-wordpress-image-editor/#comments</comments>
		<pubDate>Fri, 11 Sep 2009 10:56:08 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1690</guid>
		<description><![CDATA[
We already wrote about some new features, such as new filter and the Trash-function in WordPress. It has long been known that WordPress 2.9 will add some features for image editing - the users want these features, right in the core and not as a Plugin. You can get a first insight into the current [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://wpengineer.com/blog/wp-content/uploads/wp-image-edit1.png" ><img src="http://wpengineer.com/blog/wp-content/uploads/wp-image-edit1.png" alt="wp-image-edit1" title="wp-image-edit1" width="421" height="202" class="aligncenter size-full wp-image-1689"/></a></p>
<p>We already wrote about some new features, such as <a href="http://wpengineer.com/wordpress-2-9-new-excerpt-filters/" class="liinternal">new filter</a> and the <a href="http://wpengineer.com/wordpress-trash-is-coming/" class="liinternal">Trash-function</a> in WordPress. It has long been known that WordPress 2.9 will add some features for image editing - the users want these features, right in the core and not as a Plugin. You can get a first insight into the current development version. Since not everybody is working with it, here are some screenshots of the editor for images. The screenshots certainly speak for themselves:</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-image-edit2.png" alt="wp-image-edit2" title="wp-image-edit2" width="503" height="650" class="aligncenter size-full wp-image-1692" /></p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-image-edit3.png" alt="wp-image-edit3" title="wp-image-edit3" width="442" height="720" class="aligncenter size-full wp-image-1693" /><br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li>
<li><a href="http://wpengineer.com/wordpress-28-feature-password/" rel="bookmark" title="Permanent Link: WordPress 2.8 Feature Password" class="liinternal">WordPress 2.8 Feature Password</a></li>
<li><a href="http://wpengineer.com/use-metaboxes-in-your-theme-or-plugin/" rel="bookmark" title="Permanent Link: Use Metaboxes In Your Theme Or Plugin" class="liinternal">Use Metaboxes In Your Theme Or Plugin</a></li>
<li><a href="http://wpengineer.com/new-feature-in-wordpress-2-9-the_post_image/" rel="bookmark" title="Permanent Link: New feature in WordPress 2.9 &#8211; the_post_image()" class="liinternal">New feature in WordPress 2.9 &#8211; the_post_image()</a></li>
<li><a href="http://wpengineer.com/wordpress-2-9-add_theme_support-and-has_post_image/" rel="bookmark" title="Permanent Link: WordPress 2.9 add_theme_support and has_post_image" class="liinternal">WordPress 2.9 add_theme_support and has_post_image</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/new-feature-for-wordpress-2-9-wordpress-image-editor/feed/</wfw:commentRss>
		<slash:comments>54</slash:comments>
		</item>
		<item>
		<title>WordPress 2.9 new excerpt filters</title>
		<link>http://wpengineer.com/wordpress-2-9-new-excerpt-filters/</link>
		<comments>http://wpengineer.com/wordpress-2-9-new-excerpt-filters/#comments</comments>
		<pubDate>Thu, 10 Sep 2009 19:45:36 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[the_excerpt]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1684</guid>
		<description><![CDATA[In WordPress 2.9 there will be two new filters to adjust an excerpt (the_excerpt). Previously with the_excerpt cut off at a maximum of 55 words and add a [...]. These filters are in WordPress 2.9 expandable. To change the values, you write two functions in your theme functions.php:


// Changing excerpt length
function new_excerpt_length&#40;$length&#41; &#123;
	return 40;
&#125;
add_filter&#40;'excerpt_length', 'new_excerpt_length'&#41;;
&#160;
// [...]]]></description>
			<content:encoded><![CDATA[<p>In WordPress 2.9 there will be two new filters to adjust an excerpt (the_excerpt). Previously with the_excerpt cut off at a maximum of 55 words and add a [...]. These filters are in WordPress 2.9 expandable. To change the values, you write two functions in your theme functions.php:<br />
<span id="more-1684"></span></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// Changing excerpt length</span>
<span style="color: #000000; font-weight: bold;">function</span> new_excerpt_length<span style="color: #009900;">&#40;</span><span style="color: #000088;">$length</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #cc66cc;">40</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_length'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_length'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Changing excerpt more</span>
<span style="color: #000000; font-weight: bold;">function</span> new_excerpt_more<span style="color: #009900;">&#40;</span><span style="color: #000088;">$more</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'...'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'excerpt_more'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'new_excerpt_more'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-header/" rel="bookmark" title="Permanent Link: Cleanup WordPress Header" class="liinternal">Cleanup WordPress Header</a></li>
<li><a href="http://wpengineer.com/new-feature-for-wordpress-2-9-wordpress-image-editor/" rel="bookmark" title="Permanent Link: New Feature for WordPress 2.9 &#8211; WordPress Image Editor" class="liinternal">New Feature for WordPress 2.9 &#8211; WordPress Image Editor</a></li>
<li><a href="http://wpengineer.com/wp-roadmap/" rel="bookmark" title="Permanent Link: WP Roadmap" class="liinternal">WP Roadmap</a></li>
<li><a href="http://wpengineer.com/puplishing-extend-of-wordpress/" rel="bookmark" title="Permanent Link: Publishing Extend of WordPress" class="liinternal">Publishing Extend of WordPress</a></li>
<li><a href="http://wpengineer.com/change-your-wordpress-theme-on/" rel="bookmark" title="Permanent Link: Change your WordPress Theme on Dependency" class="liinternal">Change your WordPress Theme on Dependency</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-2-9-new-excerpt-filters/feed/</wfw:commentRss>
		<slash:comments>15</slash:comments>
		</item>
		<item>
		<title>Check If Required Plugin Is Active</title>
		<link>http://wpengineer.com/check-if-required-plugin-is-active/</link>
		<comments>http://wpengineer.com/check-if-required-plugin-is-active/#comments</comments>
		<pubDate>Mon, 07 Sep 2009 11:59:36 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1657</guid>
		<description><![CDATA[It might be, that your own written Plugin requires another stand alone Plugin to be active. For example if you like to offer a version with enhanced functionality of a Plugin. There are certainly a variety of usage and the implementation is not difficult.

For the implementation, we need the active Plugins, which are found in [...]]]></description>
			<content:encoded><![CDATA[<p>It might be, that your own written Plugin requires another stand alone Plugin to be active. For example if you like to offer a version with enhanced functionality of a Plugin. There are certainly a variety of usage and the implementation is not difficult.<br />
<! - more -></p>
<p>For the implementation, we need the active Plugins, which are found in the database, table <code>options</code>, the <code>active_plugins</code>. Afterwards, I will simply look in the array, which contains the active Plugins, whether the required plugin included and active or not:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$plugins</span> <span style="color: #339933;">=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'active_plugins'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$required_plugin</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'debug_queries/debug_queries.php'</span><span style="color: #339933;">;</span>
<span style="color: #000088;">$debug_queries_on</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">FALSE</span><span style="color: #339933;">;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">in_array</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$required_plugin</span> <span style="color: #339933;">,</span> <span style="color: #000088;">$plugins</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$debug_queries_on</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Example for yes, it's active</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/secure-include-plugin-in-wordpress/" rel="bookmark" title="Permanent Link: Secure Include Plugin In WordPress" class="liinternal">Secure Include Plugin In WordPress</a></li>
<li><a href="http://wpengineer.com/use-wordpress-27-offline/" rel="bookmark" title="Permanent Link: Use WordPress 2.7 Offline" class="liinternal">Use WordPress 2.7 Offline</a></li>
<li><a href="http://wpengineer.com/wordpress-plugin-path/" rel="bookmark" title="Permanent Link: WordPress Plugin-Path" class="liinternal">WordPress Plugin-Path</a></li>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
<li><a href="http://wpengineer.com/wordpress-plugin-compatibility-checker/" rel="bookmark" title="Permanent Link: WordPress Plugin Compatibility Checker" class="liinternal">WordPress Plugin Compatibility Checker</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/check-if-required-plugin-is-active/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Themes and automatic_feed_links</title>
		<link>http://wpengineer.com/themes-and-automatic_feed_links/</link>
		<comments>http://wpengineer.com/themes-and-automatic_feed_links/#comments</comments>
		<pubDate>Fri, 04 Sep 2009 11:56:13 +0000</pubDate>
		<dc:creator>Michael</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[Theme]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.8]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1655</guid>
		<description><![CDATA[Since WordPress 2.8, there is the function automatic_feed_links() in the function.php. Which writes the link elements for the RSS protocols in the header of the document. The advantage of this feature is, you do not need to worry about whether a change comes in the Feed-protocoll in a new version of WordPress, removed or a [...]]]></description>
			<content:encoded><![CDATA[<p>Since WordPress 2.8, there is the function <strong>automatic_feed_links()</strong> in the function.php. Which writes the link elements for the RSS protocols in the header of the document. The advantage of this feature is, you do not need to worry about whether a change comes in the Feed-protocoll in a new version of WordPress, removed or a new one is added.</p>
<p><! - more -><br />
If we develop a theme for the general public, you have 2 options. You use automatic_feed_links() and the theme does not work with WordPress prior to version 2.8, or you do not use this function and write the links as before, in your header.php.</p>
<p>I also have a 3rd alternative <img src='http://wpengineer.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> .</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'automatic_feed_links'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    automatic_feed_links<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #b1b100;">else</span> <span style="color: #009900;">&#123;</span>
    add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wpe_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: #009900;">&#125;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> wpe_feed_links<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' RSS Feed&quot; href=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'rss2_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;alternate&quot; type=&quot;application/atom+xml&quot; title=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' Atom Feed&quot; href=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'atom_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;alternate&quot; type=&quot;application/rss+xml&quot; title=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'name'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' '</span><span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'The latest comments to all posts in RSS'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; href=&quot;'</span><span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'comments_rss2_url'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">'&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>First we look if the function automatic_feed_links() exists. If not (prior to WP 2.8), we use the hook wp_head and write the links in the header of the page. Thus we don't need to adjust the header.php anymore.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/wordpress-28-body_class-automatic_feed_links/" rel="bookmark" title="Permanent Link: WordPress 2.8 body_class, automatic_feed_links" class="liinternal">WordPress 2.8 body_class, automatic_feed_links</a></li>
<li><a href="http://wpengineer.com/change-your-wordpress-theme-on/" rel="bookmark" title="Permanent Link: Change your WordPress Theme on Dependency" class="liinternal">Change your WordPress Theme on Dependency</a></li>
<li><a href="http://wpengineer.com/set-options-on-activation-themes/" rel="bookmark" title="Permanent Link: Set options on activation Themes" class="liinternal">Set options on activation Themes</a></li>
<li><a href="http://wpengineer.com/wordpress-28-small-insights/" rel="bookmark" title="Permanent Link: WordPress 2.8 &#8211; Small Insights" class="liinternal">WordPress 2.8 &#8211; Small Insights</a></li>
<li><a href="http://wpengineer.com/gravatars-use-easy/" rel="bookmark" title="Permanent Link: Gravatars Use Easy" class="liinternal">Gravatars Use Easy</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/themes-and-automatic_feed_links/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deactivate WordPress Default Widgets</title>
		<link>http://wpengineer.com/deactivate-wordpress-default-widgets/</link>
		<comments>http://wpengineer.com/deactivate-wordpress-default-widgets/#comments</comments>
		<pubDate>Wed, 02 Sep 2009 20:54:30 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Themes]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Widget]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1650</guid>
		<description><![CDATA[You do not always want to have all the widgets active, which comes within the WordPress core.
You can disable the unneccessary Widgets in your functions.php of your theme with a small function. The following syntax will switch off all the standard widgets. It should therefore be adjusted depending on your requirements:

// unregister all default WP [...]]]></description>
			<content:encoded><![CDATA[<p>You do not always want to have all the widgets active, which comes within the WordPress core.</p>
<p>You can disable the unneccessary Widgets in your <code>functions.php</code> of your theme with a small function. The following syntax will switch off all the standard widgets. It should therefore be adjusted depending on your requirements:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// unregister all default WP Widgets</span>
<span style="color: #000000; font-weight: bold;">function</span> unregister_default_wp_widgets<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Pages'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Calendar'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Archives'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Links'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Meta'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Search'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Text'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Categories'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Recent_Posts'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Recent_Comments'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_RSS'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	unregister_widget<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_Widget_Tag_Cloud'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'widgets_init'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'unregister_default_wp_widgets'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>The function <code>unregister_widget()</code> needs as parameters the class, therefore the code is working since version 2.8 only. In prior versions, Widgets were supported differently.</p>
<p>How to create your own Widgets since WordPress Version 2.8 is explained in <a href="http://wpengineer.com/wordpress-built-a-widget/" class="liinternal">Build A WordPress 2.8 Widget With The New Widget API</a>.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/add-wordpress-dashboard-widgets/" rel="bookmark" title="Permanent Link: Add WordPress Dashboard Widgets" class="liinternal">Add WordPress Dashboard Widgets</a></li>
<li><a href="http://wpengineer.com/wordpress-28-widgets-options-page/" rel="bookmark" title="Permanent Link: WordPress 2.8 Widgets Options Page &#8211; First Screenshot!" class="liinternal">WordPress 2.8 Widgets Options Page &#8211; First Screenshot!</a></li>
<li><a href="http://wpengineer.com/removing-wordpress-login-design/" rel="bookmark" title="Permanent Link: Removing WordPress Login Design" class="liinternal">Removing WordPress Login Design</a></li>
<li><a href="http://wpengineer.com/wordpress-and-register_sidebar/" rel="bookmark" title="Permanent Link: WordPress and register_sidebar" class="liinternal">WordPress and register_sidebar</a></li>
<li><a href="http://wpengineer.com/wordpress-built-a-widget/" rel="bookmark" title="Permanent Link: Build A WordPress 2.8 Widget With The New Widget API" class="liinternal">Build A WordPress 2.8 Widget With The New Widget API</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/deactivate-wordpress-default-widgets/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Disable Flash Uploader</title>
		<link>http://wpengineer.com/disable-flash-uploader/</link>
		<comments>http://wpengineer.com/disable-flash-uploader/#comments</comments>
		<pubDate>Mon, 31 Aug 2009 11:29:33 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1636</guid>
		<description><![CDATA[Not always is the Flashuploader of WordPress a blessing and several times I preferred to have it switched off. Usually if the blog is not online and is offline behind a proxy and firewall.

With the help of the Browser uploaders there is less trouble and therefore easy to abandon the added value of Flash uploaders, [...]]]></description>
			<content:encoded><![CDATA[<p>Not always is the Flashuploader of WordPress a blessing and several times I preferred to have it switched off. Usually if the blog is not online and is offline behind a proxy and firewall.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/flash-uploader.png" alt="flash-uploader"  width="450" height="187" class="aligncenter size-full wp-image-1635" /></p>
<p>With the help of the Browser uploaders there is less trouble and therefore easy to abandon the added value of Flash uploaders, like loading multiple files simultaneously. You can disable the Flash uploader by using a filter. This can be done either in your theme, stored in the <code>functions.php</code> or in a Plugin. I use the option of switching off with the help of the Plugin <a href="http://bueltge.de/wordpress-admin-theme-adminimize/674/" title="Plugin Adminimize" class="liexternal">Adminimize</a>. Alternatively, the following syntax helps and the browser uploader will be available only.</p>
<p><span id="more-1636"></span><br />
<img src="http://wpengineer.com/blog/wp-content/uploads/browser-uploader.png" alt="browser-uploader" title="browser-uploader" width="398" height="221" class="aligncenter size-full wp-image-1637"/></p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> disable_flash_uploader<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'flash_uploader'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'disable_flash_uploader'</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>In short:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'flash_uploader'</span><span style="color: #339933;">,</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'$a'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;return null;&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/disable-wordpress-feed/" rel="bookmark" title="Permanent Link: Disable WordPress Feed" class="liinternal">Disable WordPress Feed</a></li>
<li><a href="http://wpengineer.com/deactivate-wordpress-default-widgets/" rel="bookmark" title="Permanent Link: Deactivate WordPress Default Widgets" class="liinternal">Deactivate WordPress Default Widgets</a></li>
<li><a href="http://wpengineer.com/support-wpengineer/" rel="bookmark" title="Permanent Link: Support WPEngineer!" class="liinternal">Support WPEngineer!</a></li>
<li><a href="http://wpengineer.com/disable-wordpress-search/" rel="bookmark" title="Permanent Link: Disable WordPress Search" class="liinternal">Disable WordPress Search</a></li>
<li><a href="http://wpengineer.com/php-cross-reference-of-wordpress-source/" rel="bookmark" title="Permanent Link: PHP Cross Reference of WordPress Source" class="liinternal">PHP Cross Reference of WordPress Source</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/disable-flash-uploader/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Change the WordPress Message</title>
		<link>http://wpengineer.com/change-the-wordpress-message/</link>
		<comments>http://wpengineer.com/change-the-wordpress-message/#comments</comments>
		<pubDate>Mon, 24 Aug 2009 10:08:55 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1610</guid>
		<description><![CDATA[The notifications of WordPress for the author of an article or comments are not always right on the spot according to the needs. WordPress also knew that and created these functions so that it's easy to adapt notifications to your needs or can completely be replaced. Therefore, I will briefly show how to adjust the [...]]]></description>
			<content:encoded><![CDATA[<p>The notifications of WordPress for the author of an article or comments are not always right on the spot according to the needs. WordPress also knew that and created these functions so that it's easy to adapt notifications to your needs or can completely be replaced. Therefore, I will briefly show how to adjust the mails to your needs.</p>
<p>The two functions <code>wp_notify_postauthor()</code> and <code>wp_notify_moderator()</code> are used to send messages, but can be replaced. You can find these two functions in <code>wp-includes/pluggable.php</code> and there are all the functions included, which WordPress queries (<code>if ( !function_exists('set_current_user') )</code>), so that you can replace it easily. Therefore, it is a simple task to adjust the notifications in your WordPress installation.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/wp-mail.png" alt="wp-mail" title="wp-mail" width="450" height="159" class="aligncenter size-full wp-image-1609" /><br />
<span id="more-1610"></span><br />
In order to realize this, the function must be placed as a Plugin or in the <code>functions.php</code> of the themes. Thus they are available and are used by WP. The easiest way is to copy the two functions and adapt the content.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_notify_postauthor<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$comment_type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_notify_moderator<span style="color: #009900;">&#40;</span><span style="color: #000088;">$comment_id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
    <span style="color: #339933;">...</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

<p>For example, it is easy not to have the URL to delete the comment in the mail, but a link. Again, a small example. The standard line, as in the screenshot above, is as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$notify_message</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Delete it: %s'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> admin_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;comment.php?action=cdc&amp;c=<span style="color: #006699; font-weight: bold;">$comment_id</span>&quot;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span></pre></div></div>

<p>We replace this with a little HTML, and so we have a link in the email.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$notify_message</span> <span style="color: #339933;">.=</span> <span style="color: #990000;">sprintf</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'&lt;a href=&quot;%s&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Delete it'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">,</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'siteurl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;/wp-admin/comment.php?action=cdc&amp;c=<span style="color: #006699; font-weight: bold;">$comment_id</span>&quot;</span>  <span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\r</span><span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div>

<p>This should only serve as an example and plain text messages are sure to be preferred. Nevertheless, there are always demands to adapt the mail; the function <code>wp_mail()</code> is flexible enough and the contents of the mail can be replaced by the two functions and separated from the core, so you are independent from any update.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/warning-message-for-self-customized-plugins/" rel="bookmark" title="Permanent Link: Warning Message For Self Customized Plugins" class="liinternal">Warning Message For Self Customized Plugins</a></li>
<li><a href="http://wpengineer.com/change-wordpress-mail-sender/" rel="bookmark" title="Permanent Link: Change WordPress Mail Sender" class="liinternal">Change WordPress Mail Sender</a></li>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
<li><a href="http://wpengineer.com/ping-problem/" rel="bookmark" title="Permanent Link: Ping Problem?" class="liinternal">Ping Problem?</a></li>
<li><a href="http://wpengineer.com/wordpress-proxysupport/" rel="bookmark" title="Permanent Link: WordPress Proxysupport" class="liinternal">WordPress Proxysupport</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/change-the-wordpress-message/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Use WordPress Cache</title>
		<link>http://wpengineer.com/use-wordpress-cache/</link>
		<comments>http://wpengineer.com/use-wordpress-cache/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 10:19:24 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Tutorials]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WP]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1607</guid>
		<description><![CDATA[WordPress has an internal cache, also for extensions can be used. There are various functions available and you don't have to create something new, you can easily use the cache functionality of WordPress.
To get to know and understand the features a little bit, I use a small example, therefore I cache in the following tutorial [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress has an internal cache, also for extensions can be used. There are various functions available and you don't have to create something new, you can easily use the cache functionality of WordPress.<br />
To get to know and understand the features a little bit, I use a small example, therefore I cache in the following tutorial a feed, which should be displayed in the frontend.</p>
<p>All functions of <a href="http://codex.wordpress.org/Function_Reference/WP_Cache" class="liwp">cache are in the Codex</a> by WordPress listed, so a look at the Codex is worthwhile if you deal with the syntax.</p>
<p>The first cache solution came with WordPress 2.3 and was file based. The cache was optional and had some parameters to configure.<br />
You were able to activate via following constant: <code>define ( 'ENABLE_CACHE', true); </code><br />
<span id="more-1607"></span><br />
The biggest improvement happened in version 2.6, in which the cache has changed to an object-oriented solution. Therefore the opportunities for cache usage are lying rather on the server and not explicitly on WordPress. This was mainly realized in order to maximize the resources of the server and not to be handed over to WordPress. With this introduction, the cache of WordPress has no longer explicitly be activated, it is always active. Therefore, it is important that the server has a certain minimum amount of RAM available, WordPress requires 32 MByte - but that is not always the case, for example, when updating the core, it contains a call which defines the RAM to 128MByte, which in many cases is not available and therefore the update does not work.<br />
But this is not the topic of this post today, because I want to explain how to use the cache in your own extensions. So back to the syntax and I just start with the key functions to realize a small example.</p>
<p>All functions can be found in <code>wp-includes/cache.php</code>, or alternatively in <a href="http://codex.wordpress.org/Function_Reference/WP_Cache" class="liwp">Codex</a>.</p>
<p>To reset the cache, insofar there is no data for this key, you can use the following function.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param int|string $key The cache ID to use for retrieval later
 * @param mixed $data The data to add to the cache store
 * @param string $flag The group to add the cache to
 * @param int $expire When the cache data should be expired
 */</span>
wp_cache_add<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$expire</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>To delete cache data for a key, here is the opposite.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param int|string $id What the contents in the cache are called
 * @param string $flag Where the cache contents are grouped
 * @return bool True on successful removal, false on failure
 */</span>
wp_cache_delete<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Fetching data for a key is done by using:</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param int|string $id What the contents in the cache are called
 * @param string $flag Where the cache contents are grouped
 * @return bool|mixed False on failure to retrieve contents or the cache
 */</span>
wp_cache_get<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>Should within the cache to a key the content to be replaced, then the following function will work.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param int|string $id What to call the contents in the cache
 * @param mixed $data The contents to store in the cache
 * @param string $flag Where to group the cache contents
 * @param int $expire When to expire the cache contents
 * @return bool False if cache ID and group already exists, true on success
 */</span>
wp_cache_replace<span style="color: #009900;">&#40;</span><span style="color: #000088;">$key</span><span style="color: #339933;">,</span> <span style="color: #000088;">$data</span><span style="color: #339933;">,</span> <span style="color: #000088;">$flag</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$expire</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span></pre></div></div>

<p>But now a small example, which caches the feed. The feed gets loaded by <code>fetch_rss()</code>, a function of WordPress which is available since version 1.5.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$mycache</span> <span style="color: #339933;">=</span> wp_cache_get<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'mycache'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// fetch data from cache to the key &quot;mycache&quot;</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$mycache</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: #666666; font-style: italic;">// if no data, then</span>
	<span style="color: #000088;">$mycache</span> <span style="color: #339933;">=</span> fetch_rss<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;http://mycache.com/feed/&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// parse feed</span>
	wp_cache_set<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'mycache'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$mycache</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// save feed content to key &quot;mycache&quot;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #990000;">var_dump</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$mycache</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// display content</span></pre></div></div>

<p>FYI: You get an insight into the cache of WordPress easily via the variable <code>$wp_object_cache</code> or using the Plugin <a href="http://bueltge.de/debug-objects-wordpress-plugin/966/" class="liexternal">Debug Objects </a> or <a href="http://bueltge.de/wordpress-cache-steuern-plugin/819/" class="liexternal">WP Cache Inspect</a>; whereas Debug Objects explicitly has been made for this and should be used in development environments only.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/how-to-improve-wordpress-plugins/" rel="bookmark" title="Permanent Link: How To Improve WordPress Plugins" class="liinternal">How To Improve WordPress Plugins</a></li>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/use-wordpress-cache/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>Change WordPress Mail Sender</title>
		<link>http://wpengineer.com/change-wordpress-mail-sender/</link>
		<comments>http://wpengineer.com/change-wordpress-mail-sender/#comments</comments>
		<pubDate>Wed, 19 Aug 2009 10:55:04 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[WordPress Hacks]]></category>
		<category><![CDATA[WordPress Tutorials]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1604</guid>
		<description><![CDATA[WordPress makes it easy and fast to add new users in the backend. Since version 2.8 of WordPress, it can send the access information via email. A nice feature, with no additional settings to change the sender of this email. For example the email should be send from the administrator instead from WordPress.
Nevertheless, there is [...]]]></description>
			<content:encoded><![CDATA[<p>WordPress makes it easy and fast to add new users in the backend. Since version 2.8 of WordPress, it can send the access information via email. A nice feature, with no additional settings to change the sender of this email. For example the email should be send from the administrator instead from WordPress.</p>
<p>Nevertheless, there is a possibility and with the help of two hooks, the sender can be changed. I created a small Plugin, where you can easy and simple adjust the sender name and sender email.<br />
<span id="more-1604"></span>-<br />
The Plugin is available in the following source code and has no options for the backend and doesn't leave any data in the database. Anyone who wants can simply extend the Plugin.</p>

<div class="wp_syntax"><div class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">&lt;?php</span>
<span style="color: #009933; font-style: italic;">/**
 * @package WP Mail From
 * @author Frank B&amp;uuml;ltge
 * @version 0.1
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
Plugin Name: WP Mail From
Plugin URI: http://bueltge.de/
Description: Change the default address that WordPress sends it&amp;rsquo;s email from.
Version: 0.1
Author: Frank B&amp;uuml;ltge
Author URI: http://bueltge.de/
Last Change: 11.08.2009 08:41:06
*/</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'add_action'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Status: 403 Forbidden'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'HTTP/1.1 403 Forbidden'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">exit</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">class_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_mail_from'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">class</span> wp_mail_from <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000000; font-weight: bold;">function</span> wp_mail_from<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_mail_from'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_mail_from'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_mail_from_name'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_mail_from_name'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// new name</span>
		<span style="color: #000000; font-weight: bold;">function</span> fb_mail_from_name<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'My Blog is my Blog'</span><span style="color: #339933;">;</span>
			<span style="color: #666666; font-style: italic;">// alternative the name of the blog</span>
			<span style="color: #666666; font-style: italic;">// $name = get_option('blogname');</span>
			<span style="color: #000088;">$name</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span><span style="color: #000088;">$name</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$name</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #666666; font-style: italic;">// new email-adress</span>
		<span style="color: #000000; font-weight: bold;">function</span> fb_mail_from<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'info@example.com'</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$email</span> <span style="color: #339933;">=</span> is_email<span style="color: #009900;">&#40;</span><span style="color: #000088;">$email</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$email</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #009900;">&#125;</span>
&nbsp;
	<span style="color: #000088;">$wp_mail_from</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> wp_mail_from<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div>

<p>The values for name and email have to be maintain in each of the associated function. After that, the two values are getting examined, but is not necessarily needed.</p>
<p>As a note: the function <code>esc_attr()</code> is only since version 2.8 available and replaces the function <code>attribute_escape()</code>. Should the solution be used in an earlier version, then you have to change the function.</p>
<p>For suggestions and improvements, I am grateful, as always. You can use this Plugin to improve WordPress a bit and the user is not surprised about the sender "WordPress".<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/change-the-wordpress-message/" rel="bookmark" title="Permanent Link: Change the WordPress Message" class="liinternal">Change the WordPress Message</a></li>
<li><a href="http://wpengineer.com/wordpress-antispambot/" rel="bookmark" title="Permanent Link: Secure Your Mail With WordPress Antispambot Function" class="liinternal">Secure Your Mail With WordPress Antispambot Function</a></li>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
<li><a href="http://wpengineer.com/ping-problem/" rel="bookmark" title="Permanent Link: Ping Problem?" class="liinternal">Ping Problem?</a></li>
<li><a href="http://wpengineer.com/wordpress-proxysupport/" rel="bookmark" title="Permanent Link: WordPress Proxysupport" class="liinternal">WordPress Proxysupport</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/change-wordpress-mail-sender/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>2009 Open Source CMS Award: Vote For WordPress!</title>
		<link>http://wpengineer.com/2009-open-source-cms-award-vote-for-wordpress/</link>
		<comments>http://wpengineer.com/2009-open-source-cms-award-vote-for-wordpress/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 22:43:38 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Award]]></category>
		<category><![CDATA[CMS]]></category>
		<category><![CDATA[Vote]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1646</guid>
		<description><![CDATA[The 2009 Open Source CMS Award nominations have begun. Nominate your favorite CMS for the appropriate categories today and help them win their share of $24,000! 
The first two years the results were pretty boring and obvious: Drupal first and Joomla 2nd. Would be great to see WordPress on top of it or at least [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.packtpub.com/award" class="liexternal">The 2009 Open Source CMS Award</a> nominations have begun. Nominate your favorite CMS for the appropriate categories today and help them win their share of $24,000! </p>
<p>The first two years the results were pretty boring and obvious: Drupal first and Joomla 2nd. Would be great to see WordPress on top of it or at least between them.</p>
<p>So go and nominate first! You can nominate for <a href="http://www.packtpub.com/nominate-overall-open-source-cms-award-winner?cms=wordpress" class="liexternal">WordPress Best Overall Open Source CMS</a> and <a href="http://www.packtpub.com/nominate-best-open-source-php-cms?cms=wordpress" class="liexternal">Best Open Source PHP CMS</a>. </p>
<p>Support WordPress and let the others know which one is the best CMS!<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/how-to-xss-scanner-the-easy-way/" rel="bookmark" title="Permanent Link: How To XSS Scanner &#8211; The Easy Way" class="liinternal">How To XSS Scanner &#8211; The Easy Way</a></li>
<li><a href="http://wpengineer.com/last-day-to-vote-for-us-to-be-the-coolest-blog-powered-by-wordpress/" rel="bookmark" title="Permanent Link: Last Day To Vote For Us To Be The Coolest Blog Powered By WordPress" class="liinternal">Last Day To Vote For Us To Be The Coolest Blog Powered By WordPress</a></li>
<li><a href="http://wpengineer.com/use-wordpress-voting/" rel="bookmark" title="Permanent Link: Use WordPress Voting" class="liinternal">Use WordPress Voting</a></li>
<li><a href="http://wpengineer.com/we-made-it-on-the-list-of-the-coolest-blog-powered-by-wordpress/" rel="bookmark" title="Permanent Link: We Made It On The List Of The Coolest Blog Powered By WordPress" class="liinternal">We Made It On The List Of The Coolest Blog Powered By WordPress</a></li>
<li><a href="http://wpengineer.com/core-plugins/" rel="bookmark" title="Permanent Link: Core Plugins &#8211; Bless Or Curse" class="liinternal">Core Plugins &#8211; Bless Or Curse</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/2009-open-source-cms-award-vote-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>WordPress Trash Is Coming</title>
		<link>http://wpengineer.com/wordpress-trash-is-coming/</link>
		<comments>http://wpengineer.com/wordpress-trash-is-coming/#comments</comments>
		<pubDate>Mon, 17 Aug 2009 10:19:12 +0000</pubDate>
		<dc:creator>Frank</dc:creator>
				<category><![CDATA[WordPress News]]></category>
		<category><![CDATA[Constants]]></category>
		<category><![CDATA[WordPress]]></category>
		<category><![CDATA[wp2.9]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1580</guid>
		<description><![CDATA[
I would like to show you briefly what the new function trash is all about.
Users of Gmail are aware of the possibility in a web application: you move content into the trash and the content will be deleted after a certain time. Alternatively, you can also restore the content, always depending on a defined time [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://wpengineer.com/blog/wp-content/uploads/post-trash.png" alt="post-trash" title="post-trash" width="292" height="207" class="alignright size-full wp-image-1578" /><br />
I would like to show you briefly what the new function trash is all about.</p>
<p>Users of Gmail are aware of the possibility in a web application: you move content into the trash and the content will be deleted after a certain time. Alternatively, you can also restore the content, always depending on a defined time frame.</p>
<p>WordPress integrates this function also in WordPress 2.9 for articles and comments. Some screenshots showing the function in articles and comments.</p>
<p><span id="more-1580"></span><br />
<img src="http://wpengineer.com/blog/wp-content/uploads/trash-comment.png" alt="trash-comment" title="trash-comment" width="436" height="182" class="aligncenter size-full wp-image-1581" /><br />
<img src="http://wpengineer.com/blog/wp-content/uploads/edit-posts.png" alt="edit-posts" title="edit-posts" width="351" height="145" class="aligncenter size-full wp-image-1579" /></p>
<p>The time period is via constant defined, default are 30 days. If you want to change this value, it must be defined in <code>wp-config.php</code>.<br />
<code>define( 'EMPTY_TRASH_DAYS', 30 );</code></p>
<p>For developers, there are two hooks - for articles and comments, where you can intervene.<br />
<code><br />
 * @uses do_action() on 'untrash_post' before undeletion<br />
 * @uses do_action() on 'untrashed_post' after undeletion<br />
</code><br />
<code><br />
 * @uses do_action() on 'untrash_comment' before undeletion<br />
 * @uses do_action() on 'untrashed_comment' after undeletion<br />
</code></p>
<p>Otherwise, version 2.9 gets some more advanced features for media, as the users in <a href="http://wordpress.org/development/2009/07/2-9-vote-results/" class="liwp">the last survey</a> decided. These will also be available in the core and thus the system continues to inflate. A pity, in my view that the user does not use<a href="http://wpengineer.com/core-plugins/" class="liinternal"> the option of "Canonical Plugins" </a>.<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/new-feature-for-wordpress-2-9-wordpress-image-editor/" rel="bookmark" title="Permanent Link: New Feature for WordPress 2.9 &#8211; WordPress Image Editor" class="liinternal">New Feature for WordPress 2.9 &#8211; WordPress Image Editor</a></li>
<li><a href="http://wpengineer.com/wp-worldmap-get-to-know-your-wordpress-neighbour/" rel="bookmark" title="Permanent Link: WP Worldmap &#8211; Get to Know Your WordPress Neighbour!" class="liinternal">WP Worldmap &#8211; Get to Know Your WordPress Neighbour!</a></li>
<li><a href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li>
<li><a href="http://wpengineer.com/new-navi-design-in-wordpress-27/" rel="bookmark" title="Permanent Link: New Navi-Design in WordPress 2.7" class="liinternal">New Navi-Design in WordPress 2.7</a></li>
<li><a href="http://wpengineer.com/use-wordpress-27-offline/" rel="bookmark" title="Permanent Link: Use WordPress 2.7 Offline" class="liinternal">Use WordPress 2.7 Offline</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/wordpress-trash-is-coming/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Join To Design A Graphic For The New Maintenance Mode Plugin</title>
		<link>http://wpengineer.com/join-to-design-a-graphic-for-the-new-maintenance-mode-plugin/</link>
		<comments>http://wpengineer.com/join-to-design-a-graphic-for-the-new-maintenance-mode-plugin/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 09:57:28 +0000</pubDate>
		<dc:creator>Alex</dc:creator>
				<category><![CDATA[WordPress Plugins]]></category>
		<category><![CDATA[Design Competition]]></category>
		<category><![CDATA[Maintenance Mode]]></category>
		<category><![CDATA[Plugin]]></category>
		<category><![CDATA[Wartungsmodus]]></category>
		<category><![CDATA[WordPress]]></category>

		<guid isPermaLink="false">http://wpengineer.com/?p=1585</guid>
		<description><![CDATA[The Maintenance Mode Plugin "!Wartungsmodus" is a very often used Plugin but I hardly changed it for a long time. But not long ago David Hellmann came up with a wonderful design proposal and I created the Plugin completely new with different options. From now on you can pick the design for the maintenance page. [...]]]></description>
			<content:encoded><![CDATA[<p>The Maintenance Mode Plugin "<a href="http://wordpress.org/extend/plugins/wartungsmodus/" class="liwp">!Wartungsmodus</a>" is a very often used Plugin but I hardly changed it for a long time. But not long ago <a href="http://www.davidhellmann.com/" class="liexternal">David Hellmann</a> came up with a wonderful design proposal and I created the Plugin completely new with different options. From now on you can pick the design for the maintenance page. Also, you can choose various options without changing the code.</p>
<h4>A short description of the Plugin:</h4>
<p>It adds a maintenance-page to your blog that lets visitors know your blog is down for maintenance. User with rights for theme-options get full access to the blog including the frontend. This Plugin writes nothing in your database! Activate the Plugin and your blog is in maintenance-mode. Nevertheless, it was important to me that it is simple and easy to use, and so there is no separate page in the backend just for the settings. You can adjust the settings right below the Plugin in the Plugin list.</p>
<p><img src="http://wpengineer.com/blog/wp-content/uploads/maintenance-mode-backend.png" alt="maintenance-mode-backend" title="maintenance-mode-backend" width="450" height="198" class="aligncenter size-full wp-image-1589" /></p>
<h4>Where you can come in!</h4>
<p>Also, I built the site so it is quite simple to add new designs, which brought me to the idea: <strong>Send me your design proposals to info [at] wpengineer.com, and I build them into the Plugin.</strong></p>
<img src="http://wpengineer.com/blog/wp-content/uploads/maintenance-mode-1.png" alt="Aktiv Maintenance-Mode with Theme &quot;The Truck&quot; and german language" title="maintenance-mode-1" width="450" height="279" class="aligncenter size-full wp-image-1589" />
<h4>How does it work?</h4>
<p>To create new designs for the maintenance mode, I need the stylesheet from you and the relevant images, if necessary. If the text "Maintenance Mode" is an image, I also would need the image in PSD format so I can change it to English and German as an image (PNG or JPG), because the Plugin should work multilingual.</p>
<p><strong>But if you are just a designer with no CSS knowledge, we are also happy if your provide us a cool design without the CSS.</strong></p>
<p>Now, however, to write the CSS, it is necessary to follow the markup. Based on this markup, I would like to get a stylesheet from you.</p>

<div class="wp_syntax"><div class="code"><pre class="html4strict" style="font-family:monospace;"><span style="color: #00bbdd;">&lt;!DOCTYPE html PUBLIC &quot;-//W3C//DTD XHTML 1.0 Strict//EN&quot;</span>
<span style="color: #00bbdd;">&quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd&quot;&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">html</span> xmlns<span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://www.w3.org/1999/xhtml&quot;</span> xml:<span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;de&quot;</span> <span style="color: #000066;">lang</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;de&quot;</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;wartungsmodus&quot;</span> &gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">title</span>&gt;</span>Blogname - Maintenance Mode<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">title</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">head</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;header&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>WP Dev<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;content&quot;</span>&gt;</span>
&nbsp;
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>Maintenance Mode<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">h1</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;</span>Sorry for the inconvenience.<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>Our website is currently undergoing scheduled maintenance.<span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">strong</span>&gt;</span>Please try back in 231 weeks.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">strong</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">br</span> <span style="color: #66cc66;">/</span>&gt;</span>Thank you for your understanding.<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">class</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;admin&quot;</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://example.com/wp-admin/&quot;</span>&gt;</span>Admin-Login<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
    <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">div</span> <span style="color: #000066;">id</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;footer&quot;</span>&gt;</span>
        <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">p</span>&gt;&lt;<span style="color: #000000; font-weight: bold;">a</span> <span style="color: #000066;">href</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://bueltge.de/&quot;</span>&gt;</span>Plugin by: <span style="color: #009900;">&lt;<span style="color: #000000; font-weight: bold;">img</span> <span style="color: #000066;">src</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;http://bueltge.de/favicon.ico&quot;</span> <span style="color: #000066;">alt</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;bueltge.de&quot;</span> <span style="color: #000066;">width</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;16&quot;</span> <span style="color: #000066;">height</span><span style="color: #66cc66;">=</span><span style="color: #ff0000;">&quot;16&quot;</span> <span style="color: #66cc66;">/</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">a</span>&gt;&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">p</span>&gt;</span>
    <span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">div</span>&gt;</span>
&nbsp;
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">body</span>&gt;</span>
<span style="color: #009900;">&lt;<span style="color: #66cc66;">/</span><span style="color: #000000; font-weight: bold;">html</span>&gt;</span></pre></div></div>

<p>But as a normal user you can also add your own stylesheet and add the URL of this style to the options of the Plugin. Write your style according to this markup and upload to your webspace; after that add the URL including http:// to the settings of this Plugin and change the theme to "My Theme":</p>
<h4>What are the benefits to provide a design?</h4>
<p>I'm sure many will ask. I just hope that you recognize the value for you and the community. You get recognition by our readers and users of this Plugin. In addition, I will of course list the authors of the designs on the Plugin page at <a href="http://wordpress.org/extend/plugins/wartungsmodus/" class="liwp">wordpress.org</a>. Optional is a link on the site, if the maintenance mode is active, so depending on the design, the favicon of the designer is listed. Since the Plugin is under GNU license, it is possible to disable the link in the backend of WordPress.</p>
<p>Last but not least not to forget it is fun and should not be difficult to create a graphic or CSS for the design.</p>
<img src="http://wpengineer.com/blog/wp-content/uploads/maintenance-mode-2.png" alt="Active Maintenance-Mode with Theme &quot;The Sun&quot;" title="maintenance-mode-2" width="450" height="255" class="aligncenter size-full wp-image-1589" />
<h4>Time frame?</h4>
<p>Basically, you can always send me new designs <strong>info [at] wpengineer.com</strong>, I will install them after review. But beginning of September we will let our readers vote for the best Maintenance Mode design and the top 10 designs will be included in the Plugin. It would be great if you can send your designs <strong>by August 31st!</strong></p>
<p>Please send your design as ZIP file with all the data to <strong>info [at] wpengineer.com</strong>. We really appreciate your contribution!</p>
<p>I'm anxious to see your ideas and creativity!<br />
<hr />
<h3>Related posts:</h3>
<ul>
<li><a href="http://wpengineer.com/moving-your-wordpress-blog-to-a-new-domain/" rel="bookmark" title="Permanent Link: Moving Your WordPress Blog To A New Domain" class="liinternal">Moving Your WordPress Blog To A New Domain</a></li>
<li><a href="http://wpengineer.com/batch-plugin-update-in-wordpress-2-9/" rel="bookmark" title="Permanent Link: Batch Plugin-Update in WordPress 2.9" class="liinternal">Batch Plugin-Update in WordPress 2.9</a></li>
<li><a href="http://wpengineer.com/how-core-update-in-wordpress-27-works/" rel="bookmark" title="Permanent Link: How Core Update in WordPress 2.7 Works?" class="liinternal">How Core Update in WordPress 2.7 Works?</a></li>
<li><a href="http://wpengineer.com/how-to-start-blogging/" rel="bookmark" title="Permanent Link: How To Start Blogging?" class="liinternal">How To Start Blogging?</a></li>
<li><a href="http://wpengineer.com/analyze-wordpress-performance-plugin/" rel="bookmark" title="Permanent Link: Analyze WordPress Performance &#8211; Plugin!" class="liinternal">Analyze WordPress Performance &#8211; Plugin!</a></li>
</ul>
<hr />
<p><img style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br />
&copy; <a href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p>
]]></content:encoded>
			<wfw:commentRss>http://wpengineer.com/join-to-design-a-graphic-for-the-new-maintenance-mode-plugin/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
