<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>WP Engineer &#187; WordPress Plugins</title> <atom:link href="http://wpengineer.com/category/wordpress-plugins/feed/" rel="self" type="application/rss+xml" /><link>http://wpengineer.com</link> <description>WordPress News, Hacks, Tipps, Tutorials, Plugins and Themes</description> <lastBuildDate>Wed, 28 Jul 2010 13:37:05 +0000</lastBuildDate> <language>en</language> <sy:updatePeriod>hourly</sy:updatePeriod> <sy:updateFrequency>1</sy:updateFrequency> <generator>http://wordpress.org/?v=945</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>How To List All Posts Of An Archive, A Category Or A Search Result</title><link>http://wpengineer.com/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/</link> <comments>http://wpengineer.com/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/#comments</comments> <pubDate>Sat, 26 Jun 2010 07:52:28 +0000</pubDate> <dc:creator>Michael</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Plugin]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=2031</guid> <description><![CDATA[Archive pages are usually paged according to your settings in options/reading. Sometimes you may want to offer a page with all posts for an archive (time, category, search result). You need: a separate address for the unpaged archive, a filter for the internal WordPress query and a link to your ‘all posts’ page. We put [...]]]></description> <content:encoded><![CDATA[<p>Archive pages are usually paged according to your settings in options/reading. Sometimes you may want to offer a page with all posts for an archive (time, category, search result).</p><p>You need:</p><ul><li>a separate address for the unpaged archive,</li><li>a filter for the internal WordPress query and</li><li>a link to your ‘all posts’ page.</li></ul><p>We put everything into a class to avoid name collisions and to keep the global namespace clean.<br
/> We name the file <code>class.View_All_Posts.php</code>.</p><p>Let’s start with the class, the parameter and a checker, this is easy:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">class</span> View_All_Posts
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * GET parameter to trigger a complete, not paged archive.
     * @var string
     */</span>
    protected <span style="color: #000088;">$all_param</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Are we there already?
     *
     * @return bool
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> is_all_posts<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: #990000;">isset</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">all_param</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>For the address I use a very simple approach: a GET parameter named <code>all</code>. You may change the name here; just stay with ASCII chars from a—z. <samp
lang="ru">все_сообщения</samp> will get you in trouble!</p><p>Next we need a constructor that manages our work:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/* Register the query argument. */</span>
        add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query_vars'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_query_arg'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/* Hook into the query. */</span>
        add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'view_all_posts'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div><p>The constructor references two internal functions – <code>add_query_arg()</code> and view_all_posts(), which we build next:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * Registers the query arg in WordPress.
     * Otherwise it will be unset.
     *
     * @param  array $vars Already registered query args.
     * @return array
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> add_query_arg<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_arg</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: #009933; font-style: italic;">/**
     * Alters the query to remove the paging.
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> view_all_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_all_posts</span><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: #b1b100;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_query'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&amp;</span>gt<span style="color: #339933;">;</span>query_vars<span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nopaging'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div><p>The first function just registers our GET parameter in WordPress. The second alters the query to the database and removes the paging.</p><p>We are almost done. A template tag for the link would be nice, wouldn’t it?</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * Creates the markup for the link.
     *
     * Usage in archive.php, category.php or search.php:
     * $GLOBALS['view_all_posts']-&gt;get_allposts_link();
     *
     * @param  string $text Linktext
     * @param  bool   $print echo or return
     * @return string|void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> get_allposts_link<span style="color: #009900;">&#40;</span>
        <span style="color: #000088;">$text</span>   <span style="color: #339933;">=</span> <span style="color: #0000ff;">'View all posts'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$before</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;p class=&quot;allpostslink&quot;&gt;'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$after</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;/p&gt;;'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$print</span>  <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span>
    <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_all_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
         or <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_query'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">found_posts</span> <span style="color: #339933;">&lt;=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page'</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;">// No link needed.</span>
            <span style="color: #b1b100;">return</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: #990000;">isset</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">empty</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</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;">/* We have already visible GET parameters: /?hello=world. */</span>
            <span style="color: #000088;">$new_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;amp;'</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: #666666; font-style: italic;">/* Note the difference: REQUEST_URL doesn't include
             * the query string while REQUEST_URI does. */</span>
            <span style="color: #000088;">$new_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URL'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$before</span>&lt;a href='<span style="color: #006699; font-weight: bold;">$new_url</span><span style="color: #006699; font-weight: bold;">$this-&gt;all_param</span>'&gt;<span style="color: #006699; font-weight: bold;">$text</span>&lt;/a&gt;<span style="color: #006699; font-weight: bold;">$after</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$print</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">print</span> <span style="color: #000088;">$link</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$link</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div><p>Note: <code>$GLOBALS['wp_query']->found_posts</code> holds the sum of all posts for a given query, not just for the current page. Useful if you want to print out the total number on a paged archive.</p><p>If you want to avoid duplicate content, hide the full archives from search engines in your header:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">    <span style="color: #009933; font-style: italic;">/**
     * Prevents indexing from search engines.
     *
     * Add this as an action to 'wp_head'.
     *
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> meta_noindex<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_all_posts</span><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: #b1b100;">print</span> <span style="color: #0000ff;">'&lt;meta name=&quot;robots&quot; content=&quot;noindex&quot;&gt;'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
    <span style="color: #009900;">&#125;</span></pre></div></div><p>Our class is complete. Now we put an object of the class into the global namespace …</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_all_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> View_All_Posts<span style="color: #339933;">;</span></pre></div></div><p>… add an action to <code>wp_head</code> …</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_action<span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'wp_head'</span>
<span style="color: #339933;">,</span>   <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_all_posts'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'meta_noindex'</span> <span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>… and include the file into the functions.php of our theme:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">require_once</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #009900; font-weight: bold;">DIRECTORY_SEPARATOR</span>
    <span style="color: #339933;">.</span> <span style="color: #0000ff;">'class.View_All_Posts.php'</span><span style="color: #339933;">;</span></pre></div></div><p>In our archive templates (archive.php, category.php, search.php) we print the link:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_all_posts'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_allposts_link</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>Done.</p><p>…</p><p>Oh, wait … maybe you want to see the full code? And a download link?</p><p>Here’s the link: <a
href="http://gist.github.com/gists/451940/download" class="liexternal">Download class.View_All_Posts.php</a></p><p>The complete code:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Adds a view all posts page to any query.
 * @author Thomas Scholz http://toscho.de
 * @version 1.1
 */</span>
<span style="color: #000000; font-weight: bold;">class</span> View_All_Posts
<span style="color: #009900;">&#123;</span>
    <span style="color: #009933; font-style: italic;">/**
     * GET parameter to trigger a complete, not paged archive.
     * @var string
     */</span>
    protected <span style="color: #000088;">$all_param</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'all'</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> __construct<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #666666; font-style: italic;">/* Register the query argument. */</span>
        add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'query_vars'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'add_query_arg'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">/* Hook into the query. */</span>
        add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'pre_get_posts'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'view_all_posts'</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: #009933; font-style: italic;">/**
     * Registers the query arg in WordPress.
     * Otherwise it will be unset.
     *
     * @param  array $vars Already registered query args.
     * @return array
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> add_query_arg<span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span> <span style="color: #000088;">$vars</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$vars</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_arg</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: #009933; font-style: italic;">/**
     * Alters the query to remove the paging.
     * @return void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> view_all_posts<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_all_posts</span><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: #b1b100;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_query'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">query_vars</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'nopaging'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Are we there already?
     *
     * @return bool
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> is_all_posts<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: #990000;">isset</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">all_param</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009933; font-style: italic;">/**
     * Creates the markup for the link.
     *
     * Usage in archive.php, category.php or search.php:
     * $GLOBALS['view_all_posts']-&gt;get_allposts_link();
     *
     * @param  string $text Linktext
     * @param  bool   $print echo or return
     * @return string|void
     */</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">function</span> get_allposts_link<span style="color: #009900;">&#40;</span>
        <span style="color: #000088;">$text</span>   <span style="color: #339933;">=</span> <span style="color: #0000ff;">'View all posts'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$before</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;p class=&quot;allpostslink&quot;&gt;'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$after</span>  <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;/p&gt;'</span>
    <span style="color: #339933;">,</span>   <span style="color: #000088;">$print</span>  <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">TRUE</span>
    <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_all_posts</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
        or <span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'wp_query'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">found_posts</span> <span style="color: #339933;">&lt;=</span> get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'posts_per_page'</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;">// No link needed.</span>
            <span style="color: #b1b100;">return</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: #990000;">isset</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span>
            <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span> <span style="color: #990000;">empty</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'QUERY_STRING'</span><span style="color: #009900;">&#93;</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;">/* We have already visible GET parameters: /?hello=world. */</span>
            <span style="color: #000088;">$new_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URI'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&amp;amp;'</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: #666666; font-style: italic;">/* Note the difference: REQUEST_URL doesn't include
             * the query string while REQUEST_URI does. */</span>
            <span style="color: #000088;">$new_url</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'REQUEST_URL'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?'</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
         <span style="color: #000088;">$link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">$before</span>&lt;a href='<span style="color: #006699; font-weight: bold;">$new_url</span><span style="color: #006699; font-weight: bold;">$this-&gt;all_param</span>'&gt;<span style="color: #006699; font-weight: bold;">$text</span>&lt;/a&gt;<span style="color: #006699; font-weight: bold;">$after</span>&quot;</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$print</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #009900;">&#123;</span>
            <span style="color: #b1b100;">print</span> <span style="color: #000088;">$link</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
        <span style="color: #009900;">&#125;</span>
        <span style="color: #b1b100;">return</span> <span style="color: #000088;">$link</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #000088;">$GLOBALS</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'view_all_posts'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> View_All_Posts<span style="color: #339933;">;</span></pre></div></div><p>Mission completed. Any suggestions?</p><h4>Guest Post</h4><p><img
src="http://wpengineer.com/blog/wp-content/uploads/toscho.png" alt="Thomas Scholz" title="Thomas Scholz" width="32" height="32" class="alignleft size-full wp-image-2032" />This post is written by Thomas Scholz <a
href="http://toscho.de" class="liexternal">toscho.de</a>, a good friend of us and a web designer from Halle, Germany.</p><p>Thank you very much from our part to Thomas.</p><hr
/><h3>Related posts:</h3><ul><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/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/related-posts-on-category/" rel="bookmark" title="Permanent Link: Related Posts on Category" class="liinternal">Related Posts on Category</a></li><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/new-category-templates-in-wordpress-2-9/" rel="bookmark" title="Permanent Link: New Category Templates in WordPress 2.9" class="liinternal">New Category Templates in WordPress 2.9</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/how-to-list-all-posts-of-an-archive-a-category-or-a-search-result/feed/</wfw:commentRss> <slash:comments>7</slash:comments> </item> <item><title>WordPress Plugin Development: Style Your Message Boxes</title><link>http://wpengineer.com/wordpress-plugin-development/</link> <comments>http://wpengineer.com/wordpress-plugin-development/#comments</comments> <pubDate>Thu, 29 Apr 2010 05:53:32 +0000</pubDate> <dc:creator>Alex</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[backend]]></category> <category><![CDATA[Plugin Development]]></category> <category><![CDATA[WordPress Admin]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=2004</guid> <description><![CDATA[Displaying a message to the user after he started an action belongs to a good usability. In the era of Web 2.0 applications, the user is expecting such optical signal after his actions. Also WordPress Plugin developer should give the user a result message, if necessary, provided with further information. The WordPress admin area often [...]]]></description> <content:encoded><![CDATA[<p>Displaying a message to the user after he started an action belongs to a good usability. In the era of Web 2.0 applications, the user is expecting such optical signal after his actions. Also WordPress Plugin developer should give the user a result message, if necessary, provided with further information.</p><p>The WordPress admin area often likes to show information at the top of the window. For developers, this has a great benefit: Tools for generating the error and information messages are integrated and can easily be implemented in Plugins - without any self-definitions or changes in the style sheet.</p><h4>Automatically generated information in WordPress</h4><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">wp_safe_redirect<span style="color: #009900;">&#40;</span>
  add_query_arg<span style="color: #009900;">&#40;</span>
    <span style="color: #0000ff;">'updated'</span><span style="color: #339933;">,</span>
    <span style="color: #0000ff;">'true'</span><span style="color: #339933;">,</span>
    wp_get_referer<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></pre></div></div><h4>Manual and more flexible solution to output a message box</h4><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;message&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;updated&quot;</span><span style="color: #339933;">&gt;</span>
  <span style="color: #339933;">&lt;</span>p<span style="color: #339933;">&gt;</span>
    Output
  <span style="color: #339933;">&lt;/</span>p<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div><h4>Colorful: The availability of CSS classes</h4><p>Messages within an application have to communicate different informations. For this purpose WordPress has numerous stylesheet classes available, which suits best to the message.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;message&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;updated&quot;</span><span style="color: #339933;">&gt;...&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div><p><img
src="http://wpengineer.com/blog/wp-content/uploads/wordpress-messages_updated.png" alt="" title="wordpress-messages_updated" width="474" height="200" class="aligncenter size-full wp-image-2009" /></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;message&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;error&quot;</span><span style="color: #339933;">&gt;...&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div><p><img
src="http://wpengineer.com/blog/wp-content/uploads/wordpress-messages_error.png" alt="" title="wordpress-messages_error" width="474" height="200" class="aligncenter size-full wp-image-2007" /></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;message&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;updated highlight&quot;</span><span style="color: #339933;">&gt;...&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div><p><img
src="http://wpengineer.com/blog/wp-content/uploads/wordpress-messages_highlight.png" alt="" title="wordpress-messages_highlight" width="474" height="200" class="aligncenter size-full wp-image-2008" /></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>div id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;message&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;updated below-h2&quot;</span><span style="color: #339933;">&gt;...&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div><p><img
src="http://wpengineer.com/blog/wp-content/uploads/wordpress-messages_below.png" alt="" title="wordpress-messages_below" width="474" height="200" class="aligncenter size-full wp-image-2006" /></p><h4>Recommendation</h4><p>Don't use your own format. A common and familiar message box provides trust and increases the potential of perception.</p><h4>Guest Post</h4><p><img
src="http://wpengineer.com/blog/wp-content/uploads/sergej_mueller.jpg" alt="" title="sergej_mueller" width="64" height="64" class="alignleft size-full wp-image-2005" />This post is written by Sergej Müller <a
href="http://wpseo.org" class="liexternal">wpseo.org</a>, who created the popular WordPress Plugin to optimize your SEO.</p><p>Thank you very much from our part to Sergej.</p><p>If you also like to have your interesting post published on our website, please let us know on our contact page. Of course we will appreciate your contribution!</p><hr
/><h3>Related posts:</h3><ul><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/wpengineer-mit-neuem-mitglied/" rel="bookmark" title="Permanent Link: WP Engineer With A New Member" class="liinternal">WP Engineer With A New Member</a></li><li><a
href="http://wpengineer.com/wordpress-developer-hint/" rel="bookmark" title="Permanent Link: WordPress Developer Hint" class="liinternal">WordPress Developer Hint</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/wordpress-27-update-core/" rel="bookmark" title="Permanent Link: WordPress 2.7 Update Core" class="liinternal">WordPress 2.7 Update Core</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-plugin-development/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Example How To Add Meta Boxes To Edit Area</title><link>http://wpengineer.com/example-how-to-add-meta-boxes-to-edit-area/</link> <comments>http://wpengineer.com/example-how-to-add-meta-boxes-to-edit-area/#comments</comments> <pubDate>Thu, 01 Apr 2010 06:01:27 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Code]]></category> <category><![CDATA[custom field]]></category> <category><![CDATA[meta boxes]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Plugin]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Tutorials]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1991</guid> <description><![CDATA[Additional fields, meta boxes, in the edit area of WordPress often are useful and easier for customers instead of using Custom Fields. A small Plugin will show you three options. Use it, make WordPress even better for your clients. Learn how easy it is to adjust the edit area in WordPress. This Plugin adds 3 [...]]]></description> <content:encoded><![CDATA[<p>Additional fields, meta boxes, in the edit area of WordPress often are useful and easier for customers instead of using Custom Fields. A small Plugin will show you three options. Use it, make WordPress even better for your clients. Learn how easy it is to adjust the edit area in WordPress.<br
/> <span
id="more-1991"></span><br
/> This Plugin adds 3 new field in a meta box:</p><ul><li><strong>Subtitle</strong> - a line without formatting</li><li><strong>Additional information</strong> - a complete editor, you can even add attachments, it's almost like the standard content editor.</li><li><strong>List data</strong> - It's possible to put in each line content, which will displayed as an unordered list. <code>ul</code></li></ul><p><a
href="http://wpengineer.com/blog/wp-content/uploads/different-type.png" class="liimagelink"><img
src="http://wpengineer.com/blog/wp-content/uploads/different-type.png" alt="WordPress edit area with own meta boxes" title="different-type" width="450" height="545" class="aligncenter size-full wp-image-1992" /></a></p><p>Each of these fields can be used in a theme template, since it has a template tag, which controlls the output. Only if you have data in a field it will be displayed. The following example will output the 3 fields.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">&lt;div <span style="color: #000000; font-weight: bold;">&lt;?php</span> post_class<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span> id=&quot;post-<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_ID<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;
&nbsp;
    &lt;h2&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> the_title<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>&lt;/h2&gt;
&nbsp;
    &lt;h3&gt;<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: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_DifferentTypeFacts'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> the_DifferentTypeFacts<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: #0000ff;">'heading'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h3&gt;
&nbsp;
    &lt;div class=&quot;entry&quot;&gt;
&nbsp;
        <span style="color: #000000; font-weight: bold;">&lt;?php</span> the_content<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'&lt;p class=&quot;serif&quot;&gt;Read the rest of this entry &amp;raquo;&lt;/p&gt;'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&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: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_DifferentTypeFacts'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> the_DifferentTypeFacts<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: #0000ff;">'additional-info'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&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: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_DifferentTypeFacts'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> the_DifferentTypeFacts<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: #0000ff;">'listdata'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p><a
href="http://wpengineer.com/blog/wp-content/uploads/different-type-frontend.png" class="liimagelink"><img
src="http://wpengineer.com/blog/wp-content/uploads/different-type-frontend.png" alt="Output of the contnt from the own meta boxes" title="different-type-frontend" width="450" height="343" class="aligncenter size-full wp-image-1993" /></a></p><p>This Plugin should be just an example, if you like it, you can adjust it to your liking. So you can provide a nice backend for your authors, without custom fields.</p><p>The Plugin takes care, that the meta boxes "Custom Fields" and "Trackbacks" aren't there anymore (<code>remove_meta_box()</code>); just another example for the usage of this Plugin. Here is the code and below you can find the link to download the Plugin, including readme, language file for German users and the necessary scripts.</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 Different Type
 * @author Frank B&amp;uuml;ltge
 * @version 0.1
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
    Plugin Name: Different Type
    Plugin URI: http://bueltge.de/
    Description: Add different types to posts
    Author: Frank B&amp;uuml;ltge
    Version: 0.1
    License: GPL
    Author URI: http://bueltge.de/
    Last change: 21.03.2010 01:12:21
*/</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Example for use outside the loop:
 * &lt;?php the_DifferentTypeFacts($post-&gt;ID); ?&gt;
 * @param $id Integer - Post-ID
 * @param $type String - heading, additional-info, listdata (default is ''-empty)
 *
 * Example: &lt;?php the_DifferentTypeFacts($post-&gt;ID, 'heading'); ?&gt;
 */</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//avoid direct calls to this file, because now WP core and framework has been used</span>
<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: #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: #666666; font-style: italic;">//WordPress definitions</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_CONTENT_URL'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</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> 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;">'/wp-content'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_CONTENT_DIR'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <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;">'wp-content'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_PLUGIN_URL'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_PLUGIN_URL'</span><span style="color: #339933;">,</span> WP_CONTENT_URL<span style="color: #339933;">.</span><span style="color: #0000ff;">'/plugins'</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;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_PLUGIN_DIR'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_PLUGIN_DIR'</span><span style="color: #339933;">,</span> WP_CONTENT_DIR<span style="color: #339933;">.</span><span style="color: #0000ff;">'/plugins'</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;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'PLUGINDIR'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'PLUGINDIR'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'wp-content/plugins'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// Relative to ABSPATH.  For back compat.</span>
    <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">defined</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_LANG_DIR'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
        <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'WP_LANG_DIR'</span><span style="color: #339933;">,</span> WP_CONTENT_DIR <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/languages'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// plugin definitions</span>
    <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'FB_DT_BASENAME'</span><span style="color: #339933;">,</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'FB_DT_BASEDIR'</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</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: #990000;">define</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'FB_DT_TEXTDOMAIN'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'different-types'</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;">'DifferentType'</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> DifferentType <span style="color: #009900;">&#123;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// constructor</span>
        <span style="color: #000000; font-weight: bold;">function</span> DifferentType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <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: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'admin_init'</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;">'on_admin_init'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'wp_insert_post'</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;">'on_wp_insert_post'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">10</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'init'</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;">'textdomain'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                register_uninstall_hook<span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">__FILE__</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;">'uninstall'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;admin_print_scripts-post.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'enqueue_script'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;admin_print_scripts-post-new.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'enqueue_script'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;admin_print_scripts-page.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'enqueue_script'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
                add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">&quot;admin_print_scripts-page-new.php&quot;</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'enqueue_script'</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: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// active for multilanguage</span>
        <span style="color: #000000; font-weight: bold;">function</span> <span style="color: #990000;">textdomain</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <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;">'load_plugin_textdomain'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                load_plugin_textdomain<span style="color: #009900;">&#40;</span> FB_DT_TEXTDOMAIN<span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #990000;">dirname</span><span style="color: #009900;">&#40;</span> FB_DT_BASENAME <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/languages'</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;">// unsintall all postmetadata</span>
        <span style="color: #000000; font-weight: bold;">function</span> uninstall<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #000088;">$all_posts</span> <span style="color: #339933;">=</span> get_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'numberposts=0&amp;post_type=post&amp;post_status='</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">foreach</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$all_posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$postinfo</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                delete_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$postinfo</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_different-types'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// add script</span>
        <span style="color: #000000; font-weight: bold;">function</span> enqueue_script<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            wp_enqueue_script<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'tinymce4dt'</span><span style="color: #339933;">,</span> WP_PLUGIN_URL <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> FB_DT_BASEDIR <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/js/script.js'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'jquery'</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;">// admin init</span>
        <span style="color: #000000; font-weight: bold;">function</span> on_admin_init<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'publish_posts'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
            add_meta_box<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'different_types'</span><span style="color: #339933;">,</span>
                                    __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Different Types'</span><span style="color: #339933;">,</span> FB_DT_TEXTDOMAIN <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: #339933;">&amp;</span><span style="color: #000088;">$this</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'meta_box'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span>
                                    <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'high'</span>
                                    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #666666; font-style: italic;">// remove meta box for trackbacks</span>
            remove_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'trackbacksdiv'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #666666; font-style: italic;">// remove meta box for custom fields</span>
            remove_meta_box<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'postcustom'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'post'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'normal'</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;">// check for preview</span>
        <span style="color: #000000; font-weight: bold;">function</span> is_page_preview<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
            <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preview_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #000088;">$preview</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preview'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$preview</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'true'</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;">$wpdb</span><span style="color: #339933;">;</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 <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>
                <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#91;</span><span style="color: #cc66cc;">0</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">post_type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'page'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_page'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                    <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</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;
        <span style="color: #666666; font-style: italic;">// after save post, save meta data for plugin</span>
        <span style="color: #000000; font-weight: bold;">function</span> on_wp_insert_post<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</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;">$id</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_REQUEST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'post_ID'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">is_page_preview</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$id</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span>int<span style="color: #009900;">&#41;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'preview_id'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span>current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_post'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-heading'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-heading'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'heading'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-heading'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-additional-info'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-additional-info'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional-info'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-additional-info'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-listdata'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-listdata'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'listdata'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> esc_attr<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$_POST</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'dt-listdata'</span><span style="color: #009900;">&#93;</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> <span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</span> <span style="color: #339933;">!=</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
                update_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_different-types'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">data</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;">// load post_meta_data</span>
        <span style="color: #000000; font-weight: bold;">function</span> load_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">return</span> get_post_meta<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'_different-types'</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: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// meta box on post/page</span>
        <span style="color: #000000; font-weight: bold;">function</span> meta_box<span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load_post_meta</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$data</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #000000; font-weight: bold;">?&gt;</span>
            &lt;table id=&quot;dt-page-definition&quot; width=&quot;100%&quot; cellspacing=&quot;5px&quot;&gt;
                &lt;tr valign=&quot;top&quot;&gt;
                    &lt;td style=&quot;width:20%;&quot;&gt;&lt;label for=&quot;dt-heading&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Subtitle:'</span><span style="color: #339933;">,</span> FB_DT_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;/td&gt;
                    &lt;td&gt;&lt;input type=&quot;text&quot; id=&quot;dt-heading&quot; name=&quot;dt-heading&quot; class=&quot;heading form-input-tip&quot; size=&quot;16&quot; autocomplete=&quot;off&quot; value=&quot;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'heading'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&quot; tabindex=&quot;6&quot; style=&quot;width:99.5%&quot;/&gt;&lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr valign=&quot;top&quot;&gt;
                    &lt;td&gt;&lt;label for=&quot;dt-additional-info&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Additional information:'</span><span style="color: #339933;">,</span> FB_DT_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;/td&gt;
                    &lt;td&gt;&lt;textarea cols=&quot;16&quot; rows=&quot;5&quot; id=&quot;dt-additional-info&quot; name=&quot;dt-additional-info&quot; class=&quot;additional-info form-input-tip code&quot; size=&quot;20&quot; autocomplete=&quot;off&quot; tabindex=&quot;6&quot; style=&quot;width:90%&quot;/&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> wpautop<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional-info'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;
                        &lt;table id=&quot;post-status-info&quot; cellspacing=&quot;0&quot; style=&quot;line-height: 24px;&quot;&gt;
                            &lt;tbody&gt;
                                &lt;tr&gt;
                                    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                                    &lt;td&gt;&amp;nbsp;&lt;/td&gt;
                                &lt;/tr&gt;
                            &lt;/tbody&gt;
                        &lt;/table&gt;
                    &lt;/td&gt;
                &lt;/tr&gt;
                &lt;tr valign=&quot;top&quot;&gt;
                    &lt;td&gt;&lt;label for=&quot;dt-listdata&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Listdata:'</span><span style="color: #339933;">,</span> FB_DT_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;/td&gt;
                    &lt;td&gt;&lt;textarea cols=&quot;16&quot; rows=&quot;10&quot; id=&quot;dt-listdata&quot; name=&quot;dt-listdata&quot; class=&quot;listdata form-input-tip&quot; size=&quot;20&quot; autocomplete=&quot;off&quot; tabindex=&quot;6&quot; style=&quot;width:99.5%&quot;/&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'listdata'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/textarea&gt;&lt;br /&gt;&lt;small&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> _e<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'One list per line'</span><span style="color: #339933;">,</span> FB_DT_TEXTDOMAIN <span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/small&gt;&lt;/td&gt;
                &lt;/tr&gt;
            &lt;/table&gt;
            <span style="color: #000000; font-weight: bold;">&lt;?php</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// return facts incl. markup</span>
        <span style="color: #000000; font-weight: bold;">function</span> get_DifferentTypeFacts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</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: #000088;">$type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">''</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'heading'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'heading'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'heading'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'additional-info'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional-info'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span>
                <span style="color: #b1b100;">return</span> wpautop<span style="color: #009900;">&#40;</span> wptexturize<span style="color: #009900;">&#40;</span><span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'additional-info'</span><span style="color: #009900;">&#93;</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: #0000ff;">'listdata'</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #0000ff;">''</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'listdata'</span><span style="color: #009900;">&#93;</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: #0000ff;">''</span><span style="color: #339933;">;</span>
                <span style="color: #000088;">$listdatas</span> <span style="color: #339933;">=</span> <span style="color: #990000;">preg_split</span><span style="color: #009900;">&#40;</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> <span style="color: #000088;">$value</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'listdata'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">array</span><span style="color: #009900;">&#41;</span> <span style="color: #000088;">$listdatas</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$key</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$listdata</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
                    <span style="color: #000088;">$return</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'&lt;li&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">trim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$listdata</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/li&gt;'</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #009900;">&#125;</span>
                <span style="color: #b1b100;">return</span> <span style="color: #0000ff;">'&lt;ul&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$return</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/ul&gt;'</span><span style="color: #339933;">.</span> <span style="color: #0000ff;">&quot;<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
        <span style="color: #666666; font-style: italic;">// echo facts, if exists</span>
        <span style="color: #000000; font-weight: bold;">function</span> DifferentTypeFacts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
            <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$id</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
                <span style="color: #000088;">$value</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">load_post_meta</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
                <span style="color: #b1b100;">echo</span> <span style="color: #000088;">$this</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">get_DifferentTypeFacts</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$value</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
            <span style="color: #009900;">&#125;</span>
        <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// End class</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// instance class</span>
    <span style="color: #000088;">$DifferentType</span> <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> DifferentType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #666666; font-style: italic;">// use in template</span>
    <span style="color: #000000; font-weight: bold;">function</span> the_DifferentTypeFacts<span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</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: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$DifferentType</span><span style="color: #339933;">;</span>
&nbsp;
        <span style="color: #000088;">$DifferentType</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">DifferentTypeFacts</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$string</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009900;">&#125;</span> <span style="color: #666666; font-style: italic;">// End if class exists statement</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>You can find the complete Plugin at <a
href="http://github.com/maloconny/different-type" class="liexternal">github</a>.<br
/><hr
/><h3>Related posts:</h3><ul><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/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/impressions-of-custom-post-type/" rel="bookmark" title="Permanent Link: First Impressions of Custom Post Type" class="liinternal">First Impressions of Custom Post Type</a></li><li><a
href="http://wpengineer.com/image-metadata-in-wordpress/" rel="bookmark" title="Permanent Link: Image Metadata in WordPress" class="liinternal">Image Metadata in WordPress</a></li><li><a
href="http://wpengineer.com/wordpress-3-0-menu-update/" rel="bookmark" title="Permanent Link: WordPress 3.0 Menu Update" class="liinternal">WordPress 3.0 Menu Update</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/example-how-to-add-meta-boxes-to-edit-area/feed/</wfw:commentRss> <slash:comments>13</slash:comments> </item> <item><title>WordPress: Useful Default Configuration Settings Via Plugin</title><link>http://wpengineer.com/wordpress-useful-default-configuration-settings-via-plugin/</link> <comments>http://wpengineer.com/wordpress-useful-default-configuration-settings-via-plugin/#comments</comments> <pubDate>Thu, 04 Feb 2010 11:24:41 +0000</pubDate> <dc:creator>Michael</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[options]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1957</guid> <description><![CDATA[Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend Thomas Scholz alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate [...]]]></description> <content:encoded><![CDATA[<p>Everybody who installs WordPress quite often knows the problem: You always have to do the same adjustments, for example deleting the Hello World post. That cost time and money. Our friend <a
href="http://toscho.de/" title="Toscho Design" class="liexternal">Thomas Scholz</a> alias toscho had a simple but genius idea, he puts all needed option settings in a Plugin. Just activate the Plugin, deactivate it and delete it. Done!</p><p>You can adjust and expand the options as you like. A good overview is the wp-admin/options.php.</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;">/*
Plugin Name: Toscho's basic settings
Plugin URI: http://toscho.de/2010/wordpress-grundeinstellungen-per-plugin-setzen/
Description: Some useful default configuration settings. See 'wp-admin/options.php' for more options.
Version: 0.2
Author: Thomas Scholz
Author URI: http://toscho.de
*/</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">function</span> set_toscho_defaults<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span>
<span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$o</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
        <span style="color: #0000ff;">'avatar_default'</span>            <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'blank'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'avatar_rating'</span>             <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'G'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'category_base'</span>             <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'/thema'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'comment_max_links'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'comments_per_page'</span>         <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'date_format'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'d.m.Y'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'default_ping_status'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'closed'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'default_post_edit_rows'</span>    <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">30</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'links_updated_date_format'</span> <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'j. F Y, H:i'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'permalink_structure'</span>       <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'/%year%/%postname%/'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'rss_language'</span>              <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'de'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'timezone_string'</span>           <span style="color: #339933;">=&gt;</span> <span style="color: #0000ff;">'Etc/GMT-1'</span><span style="color: #339933;">,</span>
        <span style="color: #0000ff;">'use_smilies'</span>               <span style="color: #339933;">=&gt;</span> <span style="color: #cc66cc;">0</span><span style="color: #339933;">,</span>
    <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$o</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$k</span> <span style="color: #339933;">=&gt;</span> <span style="color: #000088;">$v</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #009900;">&#123;</span>
        update_option<span style="color: #009900;">&#40;</span><span style="color: #000088;">$k</span><span style="color: #339933;">,</span> <span style="color: #000088;">$v</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;">// Delete dummy post and comment.</span>
    wp_delete_post<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</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>
    wp_delete_comment<span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #b1b100;">return</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
register_activation_hook<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'set_toscho_defaults'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><p>Here you can <a
href="http://f.toscho.de/php-skripte/toscho_basic_settings-0.2.zip" title="Download toschos plugin" class="lizip">download</a> the Plugin by toscho.</p><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/more-memory-for-wordpress-more-information-about-wordpress/" rel="bookmark" title="Permanent Link: More Memory For WordPress &#8211; More Information About WordPress" class="liinternal">More Memory For WordPress &#8211; More Information About WordPress</a></li><li><a
href="http://wpengineer.com/theme-uninstaller/" rel="bookmark" title="Permanent Link: 5th Post Of Our Advent Calendar: Theme Uninstaller" class="liinternal">5th Post Of Our Advent Calendar: Theme Uninstaller</a></li><li><a
href="http://wpengineer.com/wordpress-3-multisite-settings/" rel="bookmark" title="Permanent Link: WordPress 3.0 Multisite Settings" class="liinternal">WordPress 3.0 Multisite Settings</a></li><li><a
href="http://wpengineer.com/quick-view-on-wordpress-settings/" rel="bookmark" title="Permanent Link: Quick View on WordPress Settings" class="liinternal">Quick View on WordPress Settings</a></li><li><a
href="http://wpengineer.com/add-avatar-to-wordpress-default/" rel="bookmark" title="Permanent Link: Add Avatar To WordPress Default" class="liinternal">Add Avatar To WordPress Default</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-useful-default-configuration-settings-via-plugin/feed/</wfw:commentRss> <slash:comments>19</slash:comments> </item> <item><title>24th Door &#8211; The WPE Quit Smoking Widget</title><link>http://wpengineer.com/24th-door-the-wpe-quit-smoking-widget/</link> <comments>http://wpengineer.com/24th-door-the-wpe-quit-smoking-widget/#comments</comments> <pubDate>Thu, 24 Dec 2009 07:12:19 +0000</pubDate> <dc:creator>Michael</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Advent Calendar]]></category> <category><![CDATA[Widget]]></category> <category><![CDATA[Widget API]]></category> <category><![CDATA[WordPress]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1918</guid> <description><![CDATA[For the last door in our Advent Calendar I had something special in mind. This year is coming to an end and I'm sure some of our readers want to quit smoking next year. To support their goal, I created a WP Engineer Quit Smoking Widget. Here a screenshot of all setting possibilities: And this [...]]]></description> <content:encoded><![CDATA[<p><img
src="http://wpengineer.com/blog/wp-content/uploads/WordPress-Christmas-24.jpg" alt="" title="WordPress-Christmas-24" width="600" height="400" class="aligncenter size-full wp-image-1902" />For the last door in our Advent Calendar I had something special in mind. This year is coming to an end and I'm sure some of our readers want to quit smoking next year. To support their goal, I created a WP Engineer Quit Smoking Widget. <img
src='http://wpengineer.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /></p><p><span
id="more-1918"></span><br
/> Here a screenshot of all setting possibilities:</p><p><img
src="http://wpengineer.com/blog/wp-content/uploads/quit-smoking-widget.png" alt="WP Engineer Quit Smoking Widget" title="WPengineer Quit Smoking Widget" width="510" height="432" class="aligncenter size-full wp-image-1919" /></p><p>And this is how it would look like on your blog:</p><p><img
src="http://wpengineer.com/blog/wp-content/uploads/widget-output.png" alt="WP Enigineer Quit Smoking Widget Output" title="WP Enigineer Quit Smoking Widget Output" width="290" height="97" class="aligncenter size-full wp-image-1920" /></p><p>Even though, this idea seemed to be easy to realize. It was a piece of work. I don't want you to be bored, so I'm not explaining the whole code, but I just want go in detail on some details, what I had to consider to make this Widget workable.</p><p>I check the date if it's valid ( 2009/02/30 doesn't exist). Then I had to avoid division by zero, if the Widget is active but doesn't include any values yet. For the correct formatting of the saved money depending on the language I used the WordPress function <strong>number_format_i18n</strong>:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$saved</span> <span style="color: #339933;">=</span> number_format_i18n<span style="color: #009900;">&#40;</span><span style="color: #000088;">$packs</span> <span style="color: #339933;">*</span> <span style="color: #000088;">$price</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>Unfortunately, there is no feature in WordPress, which displays the currencies correctly (but I guess, this is probably not necessary). Therefore, I added a field "Currency position" with the values "before" and "after", so that the currency will be displayed properly, depending on the country. The year field automatically displays the current year minus 5 years, so that the widget is also current in 100 years. <img
src='http://wpengineer.com/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /><br
/> The rest are fields for entering the text output before and after values.</p><h3>Installation</h3><p>Unzip file wpe_quit_smoking_widget.zip and copy it to wp-content/plugins/ , then activate it in your backend. After that the Widget will be available in your Widgets area.</p><p>Please Note: The Widget needs <strong>WordPress Version 2.8</strong> or higher, otherwise it won't be displayed.</p><h3>Download</h3><p>Download <a
href="http://wpengineer.com/?download=WP%20Engineer%20Quit%20Smoking%20Widget" class="liinternal">WPEngineer Quit Smoking Widget</a></p><p>Have fun with the Widget and good luck with your goal to stop smoking! The team of WP Engineer wish you all Happy Holidays!</p><p><img
src="http://wpengineer.com/blog/wp-content/uploads/merry-christmas-wpengineer.jpg" alt="" title="merry-christmas-wpengineer" width="368" height="280" class="aligncenter size-full wp-image-1935" /><br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/advent-calendar-24-days-tips-and-tricks-each-day-today-wordpress-comment-form-widget/" rel="bookmark" title="Permanent Link: Advent Calendar &#8211; 24 Days Tips And Tricks Each Day! Today: WordPress Comment Form Widget" class="liinternal">Advent Calendar &#8211; 24 Days Tips And Tricks Each Day! Today: WordPress Comment Form Widget</a></li><li><a
href="http://wpengineer.com/check-for-widgets-in-widget-areas/" rel="bookmark" title="Permanent Link: Check for Widgets in Widget-Areas" class="liinternal">Check for Widgets in Widget-Areas</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/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/deactivate-wordpress-default-widgets/" rel="bookmark" title="Permanent Link: Deactivate WordPress Default Widgets" class="liinternal">Deactivate WordPress Default Widgets</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/24th-door-the-wpe-quit-smoking-widget/feed/</wfw:commentRss> <slash:comments>8</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 [...]]]></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/use-wordpress-cron/" rel="bookmark" title="Permanent Link: Use WordPress Cron" class="liinternal">Use WordPress Cron</a></li><li><a
href="http://wpengineer.com/change-wording-for-password-page/" rel="bookmark" title="Permanent Link: Change Wording for Password Page" class="liinternal">Change Wording for Password Page</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/change-wordpress-mail-sender/feed/</wfw:commentRss> <slash:comments>4</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><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" /></p><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><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" /></p><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> <item><title>Joomla Fireboard to WordPress WP-FORUM Converter</title><link>http://wpengineer.com/joomla-fireboard-wordpress-wp-forum-converter/</link> <comments>http://wpengineer.com/joomla-fireboard-wordpress-wp-forum-converter/#comments</comments> <pubDate>Mon, 03 Aug 2009 14:29:28 +0000</pubDate> <dc:creator>Alex</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Convert]]></category> <category><![CDATA[Fireboard]]></category> <category><![CDATA[Forum]]></category> <category><![CDATA[Joomla]]></category> <category><![CDATA[Transfer]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WP-Forum]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1573</guid> <description><![CDATA[Not long ago, we introduced a script by Marco to convert your Joomla content to WordPress. Now Marco from solariz.de adapted the script to convert your content of Joomla Fireborad to WordPress WP-Forum. It works exactly like the Joomla converter, it is also not a "click &#038; ready" script, basic knowledge of PHP are needed [...]]]></description> <content:encoded><![CDATA[<p>Not long ago, we <a
href="http://wpengineer.com/joomla-to-wordpress-content-converter/" class="liinternal">introduced a script by Marco</a> to convert your Joomla content to WordPress. Now Marco from <a
href="http://solariz.de" class="liexternal">solariz.de</a> adapted the script to convert your content of Joomla Fireborad to WordPress <a
href="http://www.fahlstad.se/wp-forum/" class="liexternal">WP-Forum</a>.</p><p>It works exactly like the <a
href="http://wpengineer.com/joomla-to-wordpress-content-converter/" class="liinternal">Joomla converter</a>, it is also not a "click &#038; ready" script, basic knowledge of PHP are needed in order to achieve the conversion. It is important that the WP-Forum is empty before you start to convert.</p><p>Short instructions:</p><ol><li>Install WP-Forum in your WordPress system</li><li>Create categories and sub-forums</li><li>Download script, unpack and upload to the server</li><li>Adjust the accompanying config.php</li><li>Go through the settings in config.php step by step and set the preferences</li><li>On line 37 / 38 enter the source ID of the Fireboard forum and the ID of the WP-Forum</li><li> Execute the converter</li></ol><p>After a successful conversion you should see something like this:</p><ul><li>Converting Category 5 to 3</li><li>Processing 17 Threads</li><li>Inserted 17 Threads</li><li>Inserted 84 Posts</li></ul><p>If it was successful, please repeat step 6 and 7 with all your forums.</p><p>Then you should be done!</p><p>You can <a
href="http://solariz.de/tool-box/joomla-fireboard-wordpress-wp-forum-convert-script.htm" class="liexternal">download</a> the script at the bottom of his German article.<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/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/2009-open-source-cms-award-vote-for-wordpress/" rel="bookmark" title="Permanent Link: 2009 Open Source CMS Award: Vote For WordPress!" class="liinternal">2009 Open Source CMS Award: Vote For WordPress!</a></li><li><a
href="http://wpengineer.com/display-always-subpages-in-sidebar/" rel="bookmark" title="Permanent Link: Display Always All Subpages in Sidebar" class="liinternal">Display Always All Subpages in Sidebar</a></li><li><a
href="http://wpengineer.com/load-a-stylesheet-only-if-use-gallery/" rel="bookmark" title="Permanent Link: Load A Stylesheet Only If Use Gallery" class="liinternal">Load A Stylesheet Only If Use Gallery</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/joomla-fireboard-wordpress-wp-forum-converter/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>WordPress Updates via FTP on Windows XAMPP installations</title><link>http://wpengineer.com/wordpress-updates-via-ftp-on-windows-xampp-installations/</link> <comments>http://wpengineer.com/wordpress-updates-via-ftp-on-windows-xampp-installations/#comments</comments> <pubDate>Tue, 21 Jul 2009 22:04:31 +0000</pubDate> <dc:creator>Heiko</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[FTP]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[XAMPP]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1511</guid> <description><![CDATA[Sometimes I have the need to simulate an ordinary hoster environment that behaves the same way as a real one would do. This also includes the automatic update behavior WordPress shows for Core, Plugins or Themes. In most cases this is useful for testing purpose but also to create tutorial screencasts like "How to use [...]]]></description> <content:encoded><![CDATA[<p>Sometimes I have the need to simulate an ordinary hoster environment that behaves the same way as a real one would do. This also includes the automatic update behavior WordPress shows for Core, Plugins or Themes. In most cases this is useful for testing purpose but also to create tutorial screencasts like "How to use WordPress."<br
/> But if you ever tried Windows XAMPP installations, you may know, that you are not able to show the FTP update mask like your hosting would do.</p><p>That's why I was searching a solution and was ending up with writing a new Plugin for internal testing purpose.<br
/> It extends the "<em>Dashboard</em>" -> "<em>Settings</em>" -> "<em>General Settings</em>" with following option:<br
/> <img
src="http://wpengineer.com/blog/wp-content/uploads/admin-general-settings-extension-300x113.png" alt="admin-general-settings-extension" title="admin-general-settings-extension" width="300" height="113" class="aligncenter size-medium wp-image-1514" /></p><p>If you enable this option, your local Windows based installation of XAMPP (WordPress) will ask you now at every update with the well known FTP update mask about your credentials. But it's not done by enabling this option, you will need at least a well configured FileZilla FTP Server doing the required work for you too.<br
/> Once you have configured a user, his/her home dir and access rights, WordPress will update from now on all affected components as expected <strong>but now using FTP</strong>.</p><p>The Plugin has been tested only a few days, so we are still at QA phase, but we would share this, if there is any demand for it.<br
/> Please let us know, if you are interested in. If we get a significant amount of requests, we (or especially I) will publish it on my blog <a
href="http://www.code-styling.de/english" class="liexternal">Code Styling Project</a>. This would include also a complete description, how to configure the FileZilla Server based on a simple example.</p><p><em>This is my first article at WP Engineer as new member. It may be a bit technical but my main work is normally developing solutions. I hope, it's interesting for you nevertheless.</em><br
/><hr
/><h3>Related posts:</h3><ul><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/our-wordpress-developer-toolbox/" rel="bookmark" title="Permanent Link: Our WordPress Developer Toolbox" class="liinternal">Our WordPress Developer Toolbox</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/3rd-door-today-the-advice-dont-steal-premium-wordpress-themes/" rel="bookmark" title="Permanent Link: 3rd Door &#8211; Today The Advice: Don&#8217;t Steal Premium WordPress Themes" class="liinternal">3rd Door &#8211; Today The Advice: Don&#8217;t Steal Premium WordPress Themes</a></li><li><a
href="http://wpengineer.com/ping-problem/" rel="bookmark" title="Permanent Link: Ping Problem?" class="liinternal">Ping Problem?</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-updates-via-ftp-on-windows-xampp-installations/feed/</wfw:commentRss> <slash:comments>3</slash:comments> </item> <item><title>Warning Message For Self Customized Plugins</title><link>http://wpengineer.com/warning-message-for-self-customized-plugins/</link> <comments>http://wpengineer.com/warning-message-for-self-customized-plugins/#comments</comments> <pubDate>Mon, 20 Jul 2009 14:25:36 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[Code]]></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=1486</guid> <description><![CDATA[Now and then you have to modify an existing Plugin for your own special needs. But you still get a message if an update exists for the original Plugin. If you modified the Plugin several month ago and you forgot about it, so you update the Plugin and all your modifications are gone. Most of [...]]]></description> <content:encoded><![CDATA[<p>Now and then you have to modify an existing Plugin for your own special needs. But you still get a message if an update exists for the original Plugin. If you modified the Plugin several month ago and you forgot about it, so you update the Plugin and all your modifications are gone. Most of the time you have a backup, but even though it's annoying to upload the customized Plugin again after you realized the original Plugin is not exactly what you want. Therefore you can paste a little function in the specified Plugin to display a warning right after the update message. So you won't forget, that you modified this Plugin a while ago.</p><p><a
href="http://wpengineer.com/blog/wp-content/uploads/plugin-modified-warning.jpg" class="liimagelink"><img
src="http://wpengineer.com/blog/wp-content/uploads/plugin-modified-warning-small.jpg" alt="plugin-modified-warning-small" title="plugin-modified-warning-small" width="500" height="180" class="aligncenter size-full wp-image-1498" /></a></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_update_notice<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000088;">$info</span> <span style="color: #339933;">=</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'ATTENTION! Plugin was modified.'</span><span style="color: #339933;">,</span> MY_TEXTDOMAIN <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;span class=&quot;spam&quot;&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">strip_tags</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$info</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&lt;br&gt;&lt;a&gt;&lt;b&gt;&lt;i&gt;&lt;span&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/span&gt;'</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> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
	add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'in_plugin_update_message-'</span> <span style="color: #339933;">.</span> plugin_basename<span style="color: #009900;">&#40;</span><span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_update_notice'</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-development/" rel="bookmark" title="Permanent Link: WordPress Plugin Development: Style Your Message Boxes" class="liinternal">WordPress Plugin Development: Style Your Message Boxes</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/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/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/contactable-contaktform-easy-with-wordpress/" rel="bookmark" title="Permanent Link: Contactable &#8211; Contact Form Easy with WordPress" class="liinternal">Contactable &#8211; Contact Form Easy with 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/warning-message-for-self-customized-plugins/feed/</wfw:commentRss> <slash:comments>11</slash:comments> </item> </channel> </rss>
<!-- Performance optimized by W3 Total Cache. Learn more: http://www.w3-edge.com/wordpress-plugins/

Minified using disk
Database Caching 54/130 queries in 0.428 seconds using disk
Object Caching 2901/3141 objects using disk

Served from: wpengineer.com @ 2010-07-29 13:21:07 -->