<?xml version="1.0" encoding="UTF-8"?> <rss
version="2.0"
xmlns:content="http://purl.org/rss/1.0/modules/content/"
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:atom="http://www.w3.org/2005/Atom"
xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
><channel><title>WP Engineer &#187; wp2.7</title> <atom:link href="http://wpengineer.com/tag/wp27/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=2778</generator> <xhtml:meta xmlns:xhtml="http://www.w3.org/1999/xhtml" name="robots" content="noindex" /> <item><title>WordPress Plugin-Path</title><link>http://wpengineer.com/wordpress-plugin-path/</link> <comments>http://wpengineer.com/wordpress-plugin-path/#comments</comments> <pubDate>Mon, 27 Apr 2009 13:26:26 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Plugin]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress 2.8]]></category> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[WP]]></category> <category><![CDATA[wp2.7]]></category> <category><![CDATA[wp2.8]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=1134</guid> <description><![CDATA[When working on a Plugin I noticed that the path to its files is not always complete, which depends on the WordPress version. With WordPress Version 2.8 the function plugins_url() extends and it can be incorporate in a much cleaner way, no maintenance of the folder required, where the Plugin is put. An example will [...]]]></description> <content:encoded><![CDATA[<p>When working on a Plugin I noticed that the path to its files is not always complete, which depends on the WordPress version.<br
/> With WordPress <strong>Version 2.8</strong> the function <code>plugins_url()</code> extends and it can be incorporate in a much cleaner way, no maintenance of the folder required, where the Plugin is put. An example will illustrate it and possibly will help the one or other author at his work.<br
/> <span
id="more-1134"></span><br
/> In the articles &#8222;<a
href="http://wpengineer.com/use-javascript-libraries-in-and-of-wordpress/">Use JavaScript Libraries In And Of WordPress</a>&#8220;, &#8222;<a
href="http://wpengineer.com/top-level-menu-in-wordpress-27/" class="liinternal">Top Level Menu In WordPress 2.7</a>&#8220; and &#8222;<a
href="http://wpengineer.com/wordpress-return-url/" class="liinternal">WordPress - Return URL</a>&#8220; I often have the function <code>plugins_url()</code>, because it delivers very nice the path.</p><p>As of WordPress version 2.8 the function can take two parameters:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * @param string $path Optional. Path relative to the plugins url.
 * @param string $plugin Optional. The plugin file that you want to be relative to - i.e. pass in __FILE__
 * @return string Plugins url link with optional path appended.
*/</span>
<span style="color: #000000; font-weight: bold;">function</span> plugins_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #009900;">&#41;</span></pre></div></div><p>So far only the $ path parameter could be passed, so that required a proper definition of the folder.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$style</span> <span style="color: #339933;">=</span> plugins_url<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'my_plugin_folder/css/style-frontend.css'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>With the extension in version 2.8 of WordPress it can be done like:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$style</span> <span style="color: #339933;">=</span> plugins_url<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'css/style-frontend.css'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>The use should make it simpler and clearer. But the question will come up, how do I do backwards compatibility of the plugin? You can either use the version query:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_version</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'2.8dev'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span></pre></div></div><p>and then supplement or write a custom function for the replacement:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// function for WP &lt; 2.8</span>
<span style="color: #000000; font-weight: bold;">function</span> plugins_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin</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: #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;">'is_ssl'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$scheme</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> is_ssl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #0000ff;">'https'</span> <span style="color: #339933;">:</span> <span style="color: #0000ff;">'http'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
  <span style="color: #b1b100;">else</span>
    <span style="color: #000088;">$scheme</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'http'</span><span style="color: #339933;">;</span>
  <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> WP_PLUGIN_URL<span style="color: #339933;">;</span>
  <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">0</span> <span style="color: #339933;">===</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'http'</span><span style="color: #009900;">&#41;</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: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'is_ssl'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> is_ssl<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
      <span style="color: #000088;">$url</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'http://'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;<span style="color: #006699; font-weight: bold;">{$scheme}</span>://&quot;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</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;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$plugin</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
  <span style="color: #009900;">&#123;</span>
    <span style="color: #000088;">$folder</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: #000088;">$plugin</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;">'.'</span> <span style="color: #339933;">!=</span> <span style="color: #000088;">$folder</span><span style="color: #009900;">&#41;</span>
      <span style="color: #000088;">$url</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$folder</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</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;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">is_string</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">strpos</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'..'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">===</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span>
    <span style="color: #000088;">$url</span> <span style="color: #339933;">.=</span> <span style="color: #0000ff;">'/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">ltrim</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'/'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
  <span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'plugins_url'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$url</span><span style="color: #339933;">,</span> <span style="color: #000088;">$path</span><span style="color: #339933;">,</span> <span style="color: #000088;">$plugin</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>This is only an alternative, the possibilities are endless - maybe one or the other has a beautiful idea and solution?<br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/wordpress-return-url/" rel="bookmark" title="Permanent Link: WordPress &#8211; Return URL" class="liinternal">WordPress &#8211; Return URL</a></li><li><a
href="http://wpengineer.com/determine-path-to-plugin-and-content-directories/" rel="bookmark" title="Permanent Link: Determine Path To Plugin and Content Directories" class="liinternal">Determine Path To Plugin and Content Directories</a></li><li><a
href="http://wpengineer.com/my-hacksphp/" rel="bookmark" title="Permanent Link: Bye Bye my-hacks.php?" class="liinternal">Bye Bye my-hacks.php?</a></li><li><a
href="http://wpengineer.com/embed-wordpress-functions-outside-wordpress/" rel="bookmark" title="Permanent Link: Embed WordPress Functions Outside WordPress" class="liinternal">Embed WordPress Functions Outside WordPress</a></li><li><a
href="http://wpengineer.com/top-level-menu-in-wordpress-27/" rel="bookmark" title="Permanent Link: Top Level Menu In WordPress 2.7" class="liinternal">Top Level Menu In WordPress 2.7</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-path/feed/</wfw:commentRss> <slash:comments>5</slash:comments> </item> <item><title>Numbering your comments, pingbacks, trackbacks or all</title><link>http://wpengineer.com/numbering-your-comments-pingbacks-trackbacks-or-all/</link> <comments>http://wpengineer.com/numbering-your-comments-pingbacks-trackbacks-or-all/#comments</comments> <pubDate>Tue, 03 Feb 2009 12:51:04 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[Code]]></category> <category><![CDATA[comments]]></category> <category><![CDATA[Theme]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[WP]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=759</guid> <description><![CDATA[Since WordPress 2.7 exists an API for the comment area. Thereby you can purge the PHP-portion within comments.php. Jean-Baptiste shows a simple solution to count comments. This solution is very well known and get used pretty much since the first release of WordPress. But if you like to have a filter, which counts only the [...]]]></description> <content:encoded><![CDATA[<p>Since WordPress 2.7 exists an API for the comment area. Thereby you can purge the PHP-portion within <code>comments.php</code>. <a
href="http://www.wprecipes.com/how-to-number-your-comments" class="liexternal">Jean-Baptiste</a> shows a simple solution to count comments. This solution is very well known and get used pretty much since the first release of WordPress. But if you like to have a filter, which counts only the trackbacks or only the comments, then this solutions is worthless. Besides that, the How To is pretty poor and PHP-rookies could have troubles with it.</p><p>Relating to this and because of many questions about this topic I show you two simple functions, which you insert in your <code>functions.php</code> of your theme. Normally they get used as output in your <code>comments.php</code>.<br
/> <span
id="more-759"></span></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * count for Trackback, pingback, comment, pings
 *
 * use it:
 * fb_comment_type_count('ping');
 * fb_comment_type_count('comment');
 */</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;">'fb_comment_type_count'</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;">function</span> fb_get_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$zero</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$one</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</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;">$cjd_comment_count_cache</span><span style="color: #339933;">,</span> <span style="color: #000088;">$id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post</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: #000088;">$post_id</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #339933;">!</span><span style="color: #000088;">$post_id</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: #339933;">!</span><span style="color: #990000;">isset</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post_id</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: #000088;">$p</span> <span style="color: #339933;">=</span> get_post<span style="color: #009900;">&#40;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #000088;">$p</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			update_comment_type_cache<span style="color: #009900;">&#40;</span><span style="color: #000088;">$p</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</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;">'pingback'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'trackback'</span> <span style="color: #339933;">||</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'comment'</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$type</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'pings'</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'pingback'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">+</span> <span style="color: #000088;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'trackback'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span>
			<span style="color: #000088;">$count</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_sum</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;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post_id</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fb_get_comment_type_count'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$count</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;">// comment, trackback, pingback, pings, all</span>
	<span style="color: #000000; font-weight: bold;">function</span> fb_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$type</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'all'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$zero</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$one</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$more</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">false</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_id</span> <span style="color: #339933;">=</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$number</span> <span style="color: #339933;">=</span> fb_get_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$type</span><span style="color: #339933;">,</span> <span style="color: #000088;">$zero</span><span style="color: #339933;">,</span> <span style="color: #000088;">$one</span><span style="color: #339933;">,</span> <span style="color: #000088;">$more</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_id</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: #000088;">$number</span> <span style="color: #339933;">&gt;</span> <span style="color: #cc66cc;">1</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #990000;">str_replace</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'%'</span><span style="color: #339933;">,</span> number_format_i18n<span style="color: #009900;">&#40;</span><span style="color: #000088;">$number</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$more</span> <span style="color: #009900;">&#41;</span> ? __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'% Comments'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$more</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">elseif</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$number</span> <span style="color: #339933;">==</span> <span style="color: #cc66cc;">0</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$zero</span> <span style="color: #009900;">&#41;</span> ? __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'No Comments'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$zero</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">else</span> <span style="color: #666666; font-style: italic;">// must be one</span>
			<span style="color: #000088;">$output</span> <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #339933;">===</span> <span style="color: #000088;">$one</span> <span style="color: #009900;">&#41;</span> ? __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'1 Comment'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">:</span> <span style="color: #000088;">$one</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">echo</span> apply_filters<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'fb_comment_type_count'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$output</span><span style="color: #339933;">,</span> <span style="color: #000088;">$number</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: #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;">'fb_update_comment_type_cache'</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;">function</span> fb_update_comment_type_cache<span style="color: #009900;">&#40;</span><span style="color: #339933;">&amp;</span><span style="color: #000088;">$queried_posts</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;">$cjd_comment_count_cache</span><span style="color: #339933;">,</span> <span style="color: #000088;">$wpdb</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: #000088;">$queried_posts</span> <span style="color: #009900;">&#41;</span>
			<span style="color: #b1b100;">return</span> <span style="color: #000088;">$queried_posts</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;">$queried_posts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$post</span> <span style="color: #009900;">&#41;</span>
			<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;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span>
				<span style="color: #000088;">$post_id_list</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$post</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$post_id_list</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$post_id_list</span> <span style="color: #339933;">=</span> <span style="color: #990000;">implode</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">','</span><span style="color: #339933;">,</span> <span style="color: #000088;">$post_id_list</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: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">''</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'pingback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'trackback'</span><span style="color: #009900;">&#41;</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$type</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
				<span style="color: #000088;">$counts</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 ID, COUNT( comment_ID ) AS ccount
							FROM <span style="color: #006699; font-weight: bold;">$wpdb-&gt;posts</span>
							LEFT JOIN <span style="color: #006699; font-weight: bold;">$wpdb-&gt;comments</span> ON ( comment_post_ID = ID AND comment_approved = '1' AND comment_type='<span style="color: #006699; font-weight: bold;">$type</span>' )
							WHERE post_status = 'publish' AND ID IN (<span style="color: #006699; font-weight: bold;">$post_id_list</span>)
							GROUP BY ID&quot;</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: #000088;">$counts</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: #0000ff;">''</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$type</span> <span style="color: #009900;">&#41;</span>
						<span style="color: #000088;">$type</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'comment'</span><span style="color: #339933;">;</span>
					<span style="color: #b1b100;">foreach</span> <span style="color: #009900;">&#40;</span> <span style="color: #000088;">$counts</span> <span style="color: #b1b100;">as</span> <span style="color: #000088;">$count</span> <span style="color: #009900;">&#41;</span>
						<span style="color: #000088;">$cjd_comment_count_cache</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$count</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ID</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#91;</span><span style="color: #000088;">$type</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">=</span> <span style="color: #000088;">$count</span><span style="color: #339933;">-&gt;</span><span style="color: #004000;">ccount</span><span style="color: #339933;">;</span>
				<span style="color: #009900;">&#125;</span>
			<span style="color: #009900;">&#125;</span>
		<span style="color: #009900;">&#125;</span>
&nbsp;
		<span style="color: #b1b100;">return</span> <span style="color: #000088;">$queried_posts</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>
&nbsp;
	add_filter<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'the_posts'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_update_comment_type_cache'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>If both functions in your theme are available, the usage of the 3 forms comments, trackbacks and pingbacks could look like this:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">if ( function_exists('wp_list_comments') ) {
&nbsp;
	// WP 2.7 comment loop
	if ( have_comments() ) { ?&gt;
&nbsp;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments_by_type</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'comment'</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: #000000; font-weight: bold;">?&gt;</span>
			&lt;h2 id=&quot;comments&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> fb_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'comment'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
			&lt;ol class=&quot;commentlist&quot;&gt;
				<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'type=comment&amp;callback=fb_theme_comment'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
			&lt;/ol&gt;
		<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		<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;">'fb_comment_type_count'</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;">// alternative type pings for trackback + pingback</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments_by_type</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'$post_id'</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: #000000; font-weight: bold;">?&gt;</span>
				&lt;h2 id=&quot;pingback&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> fb_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'pingback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'No Pingback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'OnePingback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Pingbacks'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
				&lt;ol class=&quot;pingbacklist&quot;&gt;
					<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type=pingback'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;/ol&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span>
			<span style="color: #666666; font-style: italic;">// alternative type pings for trackback + pingback</span>
			<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">empty</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$comments_by_type</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'trackback'</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: #000000; font-weight: bold;">?&gt;</span>
				&lt;h2 id=&quot;trackback&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> fb_comment_type_count<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'trackback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'No Trackback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'One Trackback'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'% Trackbacks'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/h2&gt;
				&lt;ol class=&quot;trackbacklist&quot;&gt;
					<span style="color: #000000; font-weight: bold;">&lt;?php</span> wp_list_comments<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'type=trackback'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
				&lt;/ol&gt;
			<span style="color: #000000; font-weight: bold;">&lt;?php</span> <span style="color: #009900;">&#125;</span> 
		<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>
&nbsp;
		&lt;div class=&quot;navigation nav_comments&quot;&gt;
			&lt;div class=&quot;alignleft&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> previous_comments_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
			&lt;div class=&quot;alignright&quot;&gt;<span style="color: #000000; font-weight: bold;">&lt;?php</span> next_comments_link<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span>&lt;/div&gt;
		&lt;/div&gt;
&nbsp;
	<span style="color: #000000; font-weight: bold;">&lt;?php</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;">// this is displayed if there are no comments so far </span>
	<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">?&gt;</span></pre></div></div><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/comment-ping-count/" rel="bookmark" title="Permanent Link: Comment And Ping Count In WordPress 2.7" class="liinternal">Comment And Ping Count In WordPress 2.7</a></li><li><a
href="http://wpengineer.com/auto-shutoff-comments-and-trackbacks/" rel="bookmark" title="Permanent Link: Auto Shutoff Comments And Trackbacks" class="liinternal">Auto Shutoff Comments And Trackbacks</a></li><li><a
href="http://wpengineer.com/wp_list_comments-in-wordpress-27/" rel="bookmark" title="Permanent Link: wp_list_comments In WordPress 2.7" class="liinternal">wp_list_comments In WordPress 2.7</a></li><li><a
href="http://wpengineer.com/exclude-category-from-turnoff-comments-automatically/" rel="bookmark" title="Permanent Link: Exclude A Category From Turn Off Comments Automatically" class="liinternal">Exclude A Category From Turn Off Comments Automatically</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></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/numbering-your-comments-pingbacks-trackbacks-or-all/feed/</wfw:commentRss> <slash:comments>20</slash:comments> </item> <item><title>Removing WordPress Login Design</title><link>http://wpengineer.com/removing-wordpress-login-design/</link> <comments>http://wpengineer.com/removing-wordpress-login-design/#comments</comments> <pubDate>Mon, 02 Feb 2009 15:26:22 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[Design]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Theme]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[WordPress Themes]]></category> <category><![CDATA[WP]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=739</guid> <description><![CDATA[In a previous post, I showed the possibility, how to use WordPress in regard to Corporate Identity. For example adjusting the login area. This shouldn't be a tough task with the according articles. Create Your Own WordPress Login Design 10 Checks to the Perfect WordPress theme In both cases I didn't talk about how to [...]]]></description> <content:encoded><![CDATA[<p>In a previous post, I showed the possibility, how to use WordPress in regard to Corporate Identity. For example adjusting the login area. This shouldn't be a tough task with the <a
href="http://wpengineer.com/create-your-own-wordpress-login-design/" class="liinternal">according</a> articles.</p><ul><li><a
href="http://wpengineer.com/create-your-own-wordpress-login-design/" class="liinternal">Create Your Own WordPress Login Design</a></li><li><a
href="http://wpengineer.com/perfect-wordpress-theme/" class="liinternal">10 Checks to the Perfect WordPress theme</a></li></ul><p>In both cases I didn't talk about how to deactivate the default WordPress layout, since I always used the example based of the WordPress stylesheet. But the stylesheet of WordPress isn't really lean and why should you load unnecessary data, which you really don't need?</p><p>With a little hook and an appropriate function I can disable to load the stylesheet of WordPress and load my own CSS - How that works can be read in both articles about adjusting theme login.<br
/> <span
id="more-739"></span></p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">basename</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'PHP_SELF'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #0000ff;">'wp-login.php'</span> <span style="color: #009900;">&#41;</span>
	add_action<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'style_loader_tag'</span><span style="color: #339933;">,</span> <span style="color: #990000;">create_function</span><span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'$a'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">&quot;return null;&quot;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>If you put the above syntax in your <code>functions.php</code>, it will also be disabled if you change or deactivate your theme.  So it's easy to adjust your frontend, backend and login area. As of my experience it is necessary in some business areas, even if it's only for small areas of the backend and login. But that is essential for me, if I like to have a <a
href="http://wpengineer.com/perfect-wordpress-theme/" class="liinternal">&#8222;perfect&#8220; Theme</a>.<br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/create-your-own-wordpress-login-design/" rel="bookmark" title="Permanent Link: Create Your Own WordPress Login Design" class="liinternal">Create Your Own WordPress Login Design</a></li><li><a
href="http://wpengineer.com/use-wordpress-login/" rel="bookmark" title="Permanent Link: Use WordPress Login" class="liinternal">Use WordPress Login</a></li><li><a
href="http://wpengineer.com/join-to-design-a-graphic-for-the-new-maintenance-mode-plugin/" rel="bookmark" title="Permanent Link: Join To Design A Graphic For The New Maintenance Mode Plugin" class="liinternal">Join To Design A Graphic For The New Maintenance Mode Plugin</a></li><li><a
href="http://wpengineer.com/new-navi-design-in-wordpress-27/" rel="bookmark" title="Permanent Link: New Navi-Design in WordPress 2.7" class="liinternal">New Navi-Design in WordPress 2.7</a></li><li><a
href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li></ul><hr
/><p><img
style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a
href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br
/> &copy; <a
href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p> ]]></content:encoded> <wfw:commentRss>http://wpengineer.com/removing-wordpress-login-design/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>Create Your Own WordPress Login Design</title><link>http://wpengineer.com/create-your-own-wordpress-login-design/</link> <comments>http://wpengineer.com/create-your-own-wordpress-login-design/#comments</comments> <pubDate>Wed, 17 Dec 2008 13:00:02 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[CSS]]></category> <category><![CDATA[Design]]></category> <category><![CDATA[Theme]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Themes]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=483</guid> <description><![CDATA[WordPress 2.7 has been released these days and comes with some updates to the backend design. I think most of you already know that there is a new login-section. The design is now equal to the new backend's and the team did only little changes. From my point of view this is very important to [...]]]></description> <content:encoded><![CDATA[<p>WordPress 2.7 has been released these days and comes with some updates to the backend design. I think most of you already know that there is a new login-section. The design is now equal to the new backend's and the team did only little changes.<br
/> From my point of view this is very important to an all-inclusive-package, like a theme &#8211; or a corporate design.<br
/> The CSS changed a bit and if anybody wants to customize the login-section, I will show how to achieve it. The CSS is also included as a good starting point for your own custom design.</p><p><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27-login.png" alt="" title="wp27-login" width="448" height="461" class="aligncenter size-full wp-image-484" /><br
/> <span
id="more-483"></span></p><h3>Loading the Stylesheet</h3><p>I have to use a simple function, which I put in <code>functions.php</code> of the current theme and integrate it via hook <code>login_head</code> into the login-head to load the css for the login-section. This will make the custom css being referenced only by one specific theme and if I switch to a different, a different css will also be loaded.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// custom login for theme</span>
<span style="color: #666666; font-style: italic;">// folder themes/theme_name/custom-login/</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_custom_login<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'&lt;link rel=&quot;stylesheet&quot; type=&quot;text/css&quot; href=&quot;'</span> <span style="color: #339933;">.</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'template_directory'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'/custom-login/custom-login.css&quot; /&gt;'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'login_head'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_custom_login'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>The stylesheet comes with the name <code>custom-login.css</code> and is located in <code>/custom-login</code> in the folder of the theme.</p><h3>The Stylesheet</h3><p>Like I already said, here is tiny example, which includes classes and id's of the login-section, so you can customize it very easily.</p><div
class="wp_syntax"><div
class="code"><pre class="css" style="font-family:monospace;">html <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">background-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#fff</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#login</span> form <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#login</span> form <span style="color: #6666ff;">.submit</span> input <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bcb38f</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#777</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#login</span> form <span style="color: #6666ff;">.submit</span> input<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border-color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bcb38f</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bcb38f</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#login</span> h1 <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.login</span> <span style="color: #cc00cc;">#nav</span> a <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#777</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #6666ff;">.login</span> <span style="color: #cc00cc;">#nav</span> a<span style="color: #3333ff;">:hover </span><span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">color</span><span style="color: #00AA00;">:</span> <span style="color: #cc00cc;">#bcb38f</span> !important<span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#wphead</span> img<span style="color: #00AA00;">,</span> <span style="color: #cc00cc;">#wphead</span> h1 <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#wphead</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#wphead-info</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">27px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
&nbsp;
<span style="color: #cc00cc;">#footer</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">display</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer_custom</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">clear</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">both</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">text-align</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">center</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">width</span><span style="color: #00AA00;">:</span> <span style="color: #933;">500px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">margin</span><span style="color: #00AA00;">:</span> <span style="color: #993333;">auto</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">height</span><span style="color: #00AA00;">:</span> <span style="color: #933;">100px</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer_custom</span> <span style="color: #6666ff;">.docs</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">padding-top</span><span style="color: #00AA00;">:</span> <span style="color: #933;">0px</span><span style="color: #00AA00;">;</span>
<span style="color: #000000; font-weight: bold;">line-height</span><span style="color: #00AA00;">:</span> <span style="color: #933;"><span style="color: #cc66cc;">100</span>%</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span>
<span style="color: #cc00cc;">#footer_image</span> <span style="color: #00AA00;">&#123;</span>
<span style="color: #000000; font-weight: bold;">border</span><span style="color: #00AA00;">:</span><span style="color: #993333;">none</span><span style="color: #00AA00;">;</span>
<span style="color: #00AA00;">&#125;</span></pre></div></div><p>The example above is just one way to customize the style. As usual there are unlimited possibilities with css and the art of it. A recommendational note from me, is to use the <a
href="http://getfirebug.com/" class="liexternal">Firebug</a> extension, which is really helpful when customizing css live. I can't mention this enough.<br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/removing-wordpress-login-design/" rel="bookmark" title="Permanent Link: Removing WordPress Login Design" class="liinternal">Removing WordPress Login Design</a></li><li><a
href="http://wpengineer.com/use-wordpress-login/" rel="bookmark" title="Permanent Link: Use WordPress Login" class="liinternal">Use WordPress Login</a></li><li><a
href="http://wpengineer.com/join-to-design-a-graphic-for-the-new-maintenance-mode-plugin/" rel="bookmark" title="Permanent Link: Join To Design A Graphic For The New Maintenance Mode Plugin" class="liinternal">Join To Design A Graphic For The New Maintenance Mode Plugin</a></li><li><a
href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li><li><a
href="http://wpengineer.com/igoogle-gadget-for-your-blog/" rel="bookmark" title="Permanent Link: iGoogle Gadget for your Blog" class="liinternal">iGoogle Gadget for your Blog</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/create-your-own-wordpress-login-design/feed/</wfw:commentRss> <slash:comments>22</slash:comments> </item> <item><title>How To Improve WordPress Plugins</title><link>http://wpengineer.com/how-to-improve-wordpress-plugins/</link> <comments>http://wpengineer.com/how-to-improve-wordpress-plugins/#comments</comments> <pubDate>Thu, 13 Nov 2008 11:00:16 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Plugins]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=353</guid> <description><![CDATA[With the upcoming WordPress release version 2.7 the menu changes to the vertical. This offers several features to the author which we already mentioned in some other posts. But this time I explicitly address Plugin authors and ask them to make their Plugins more user friendly in terms of usability. I will show only two [...]]]></description> <content:encoded><![CDATA[<p><div
id="attachment_357" class="wp-caption alignright" style="width: 164px"><img
src="http://wpengineer.com/blog/wp-content/uploads/icon-menu.png" alt="Icon for Menu" title="icon-menu" width="154" height="360" class="size-full wp-image-357" /><p
class="wp-caption-text">Icon for Menu</p></div><br
/> With the upcoming WordPress release version 2.7 the menu changes to the vertical. This offers several features to the author which we already mentioned in some other posts. But this time I explicitly address Plugin authors and ask them to make their Plugins more user friendly in terms of usability. I will show only two tiny features.<br
/> Each of them have been discussed several times on the wp-hacker-mailing-list, but nearly everybody considers them as big improvements to usability.<br
/> <span
id="more-353"></span></p><h3>Adding icons to the menu</h3><p>My first tip is how to add an icon in the Plugin menu. This is not just a great eye-catcher, but will also make the menu link more obvious and lead to an increase of usability. I won't use a link to some file for the icon this time, instead I will store the icon as a <a
href="http://en.wikipedia.org/wiki/Base64" rel="nofollow" class="liwikipedia">base64</a>-encoded string inside of the Plugin's code. The encoded string doesn't save me just the file or a folder, besides there is no access and no request done for the image, which in the end saves some time, when rendering this page.</p><p>I provide a little <a
href=""http://bueltge.de/test/image2base64/">Service</a> for anyone who doesn't want to write the converter for the image himself. You can easily use my <a
href="http://bueltge.de/test/image2base64/" class="liexternal">Image2Base64 Generator</a> for this purpose.</p><p>The icon will only appear in version 2.7 or above, which can be checked with a simple query. You can get some additional information from the comments inside the code.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Images/ Icons in base64-encoding
 * @use function fb_sayfa_sayac_get_resource_url() for display
 */</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</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;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</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;"># base64 encoding
</span>	<span style="color: #000088;">$resources</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span>
		<span style="color: #0000ff;">'ssprc.gif'</span> <span style="color: #339933;">=&gt;</span>
		<span style="color: #0000ff;">'R0lGODlhCwALAKIEANTU1Kurq/b29pSUlP///wAAAAAAAAAAAC'</span><span style="color: #339933;">.</span>
		<span style="color: #0000ff;">'H5BAEAAAQALAAAAAALAAsAAAMlSKoRMysGIZ50A1RJ3ybNow3f'</span><span style="color: #339933;">.</span>
		<span style="color: #0000ff;">'VJGoQo4nRJDdpwqjtcDy/dhLAgA7'</span><span style="color: #339933;">.</span>
		<span style="color: #0000ff;">''</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;">array_key_exists</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</span><span style="color: #009900;">&#93;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$resources</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$content</span> <span style="color: #339933;">=</span> <span style="color: #990000;">base64_decode</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$resources</span><span style="color: #009900;">&#91;</span> <span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</span><span style="color: #009900;">&#93;</span> <span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		<span style="color: #000088;">$lastMod</span> <span style="color: #339933;">=</span> <span style="color: #990000;">filemtime</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: #000088;">$client</span> <span style="color: #339933;">=</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;">'HTTP_IF_MODIFIED_SINCE'</span><span style="color: #009900;">&#93;</span><span style="color: #009900;">&#41;</span> ? <span style="color: #000088;">$_SERVER</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'HTTP_IF_MODIFIED_SINCE'</span><span style="color: #009900;">&#93;</span> <span style="color: #339933;">:</span> <span style="color: #009900; font-weight: bold;">false</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #666666; font-style: italic;">// Checking if the client is validating his cache and if it is current.</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;">$client</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #009900;">&#40;</span><span style="color: #990000;">strtotime</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$client</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$lastMod</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;">// Client's cache IS current, so we just respond '304 Not Modified'.</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Last-Modified: '</span><span style="color: #339933;">.</span><span style="color: #990000;">gmdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lastMod</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' GMT'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">304</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">exit</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;">// Image not cached or cache outdated, we respond '200 OK' and output the image.</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Last-Modified: '</span><span style="color: #339933;">.</span><span style="color: #990000;">gmdate</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'D, d M Y H:i:s'</span><span style="color: #339933;">,</span> <span style="color: #000088;">$lastMod</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">.</span><span style="color: #0000ff;">' GMT'</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">true</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">200</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">header</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Content-Length: '</span><span style="color: #339933;">.</span><span style="color: #990000;">strlen</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$content</span><span style="color: #009900;">&#41;</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;">'Content-Type: image/'</span> <span style="color: #339933;">.</span> <span style="color: #990000;">substr</span><span style="color: #009900;">&#40;</span><span style="color: #990000;">strrchr</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$_GET</span><span style="color: #009900;">&#91;</span><span style="color: #0000ff;">'resource'</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: #339933;">,</span> <span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
			<span style="color: #b1b100;">echo</span> <span style="color: #000088;">$content</span><span style="color: #339933;">;</span>
			<span style="color: #990000;">exit</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
	<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * Display Images/ Icons in base64-encoding
 * @return $resourceID
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_sayfa_sayac_get_resource_url<span style="color: #009900;">&#40;</span><span style="color: #000088;">$resourceID</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> trailingslashit<span style="color: #009900;">&#40;</span> get_bloginfo<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'url'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'?resource='</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$resourceID</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * add menu in backend
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_sayfa_sayac_add_menu<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #000000; font-weight: bold;">global</span> <span style="color: #000088;">$wp_version</span><span style="color: #339933;">;</span>
	<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> current_user_can<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'edit_posts'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">&amp;&amp;</span> <span style="color: #990000;">function_exists</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'add_submenu_page'</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
		<span style="color: #000088;">$menutitle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">''</span><span style="color: #339933;">;</span>
		<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> <span style="color: #990000;">version_compare</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$wp_version</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'2.6.999'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'&gt;'</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
			<span style="color: #000088;">$menutitle</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;img src=&quot;'</span> <span style="color: #339933;">.</span> wpag_get_resource_url<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'ssprc.gif'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&quot; alt=&quot;&quot; /&gt;'</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">' '</span><span style="color: #339933;">;</span>
		<span style="color: #009900;">&#125;</span>
		<span style="color: #000088;">$menutitle</span> <span style="color: #339933;">.=</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Post Read Counter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sayfasayacprc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
		add_submenu_page<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'index.php'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Sayfa Sayac - Post Read Counter'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'sayfasayacprc'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$menutitle</span><span style="color: #339933;">,</span> <span style="color: #cc66cc;">9</span><span style="color: #339933;">,</span> <span style="color: #009900; font-weight: bold;">__FILE__</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_sayfa_sayac_statistic'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$plugin</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> 
		add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'plugin_action_links_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$plugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_sayfa_sayac_plugin_actions'</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>I append an additional space to the the img tag, so it's not touching the menu text. You can also achieve this with a CSS style, but this will most likely be an inline style, which is unnecessary code and the performance will suffer a little bit in your backend. I have been talking about this to the WordPress developers for some time and maybe we will get the CSS definitions with 2.7.</p><h3>Direct link to "Settings"</h3><p><div
id="attachment_355" class="wp-caption alignnone" style="width: 186px"><img
src="http://wpengineer.com/blog/wp-content/uploads/settings.png" alt="Settings links" title="settings" width="176" height="268" class="size-full wp-image-355" /><p
class="wp-caption-text">Settings links</p></div></p><p>If you read the code above carefully, you probably noticed the use of the filter <code>plugin_action_links</code>. I use this filter to add a "Settings" link. This makes it easier for the user to find the settings page of your Plugin. Mostly the user has to search for the settings page of your Plugin, this can be a real time saver. In my screenshot you can see that I always put the "Settings" leftmost to the standard links <em>"Deactivate"</em> and <em>"Edit"</em>.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Adds an action link to the Plugins page
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_sayfa_sayac_plugin_actions<span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000088;">$settings_link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;sayfa_sayac_de.php&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Settings'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
	<span style="color: #990000;">array_unshift</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$links</span><span style="color: #339933;">,</span> <span style="color: #000088;">$settings_link</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
&nbsp;
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$links</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>The above function only works in WordPress 2.7 (more Informations form <a
href="http://elektroelch.de/blog/2008/11/06/wordpress-absprung-im-plugin-bereich-v27/" class="liexternal">Latz on his post</a> in German) and has been explained in great detail by <a
href="http://elektroelch.de/blog/direct-settings-27/" class="liexternal">Latz</a>! If you like to preserve compatibility with previous WordPress versions, you can do it with this snippet:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Adds an action link to the Plugins page
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> fb_sayfa_sayac_plugin_actions<span style="color: #009900;">&#40;</span><span style="color: #000088;">$links</span><span style="color: #339933;">,</span> <span style="color: #000088;">$file</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
	static <span style="color: #000088;">$this_plugin</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: #000088;">$this_plugin</span> <span style="color: #009900;">&#41;</span> <span style="color: #000088;">$this_plugin</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>
&nbsp;
	<span style="color: #b1b100;">if</span><span style="color: #009900;">&#40;</span> <span style="color: #000088;">$file</span> <span style="color: #339933;">==</span> <span style="color: #000088;">$this_plugin</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#123;</span>
		<span style="color: #000088;">$settings_link</span> <span style="color: #339933;">=</span> <span style="color: #0000ff;">'&lt;a href=&quot;index.php?page=sayfa_sayac/sayfa_sayac_de.php&quot;&gt;'</span> <span style="color: #339933;">.</span> __<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'Settings'</span><span style="color: #009900;">&#41;</span> <span style="color: #339933;">.</span> <span style="color: #0000ff;">'&lt;/a&gt;'</span><span style="color: #339933;">;</span>
		<span style="color: #000088;">$links</span> <span style="color: #339933;">=</span> <span style="color: #990000;">array_merge</span><span style="color: #009900;">&#40;</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #000088;">$settings_link</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #000088;">$links</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> <span style="color: #666666; font-style: italic;">// before other links</span>
	<span style="color: #009900;">&#125;</span>
	<span style="color: #b1b100;">return</span> <span style="color: #000088;">$links</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>If you have to use this snippet, then the filter has to be used in a different way. You have to replace the code in function <code>fb_sayfa_sayac_add_menu()</code>:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$plugin</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> 
add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'plugin_action_links_'</span> <span style="color: #339933;">.</span> <span style="color: #000088;">$plugin</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_sayfa_sayac_plugin_actions'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>with this</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">add_filter<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'plugin_action_links'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_sayfa_sayac_plugin_actions'</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></pre></div></div><h3>Activate both hooks</h3><p>I can activate both hooks using the action <code>admin_menu</code>. Beforehand I check if the user is in the admin menu, so the code doesn't get evaluated if he is not.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">/* Register WordPress hooks */</span>
<span style="color: #b1b100;">if</span> <span style="color: #009900;">&#40;</span> is_admin<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'admin_menu'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'fb_sayfa_sayac_add_menu'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span></pre></div></div><p>I think that these two features really add some extra value for all WordPress users. Besides many Plugins have these features already integrated and I'm sure some more Plugins will get updated soon. Many users have confirmed the better usability, especially with the "Settings" link. Please use our comment area for more ideas, critics and compliments. We appreciate any suggestions you can give.<br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/meta-links-for-wordpress-plugins/" rel="bookmark" title="Permanent Link: Set Meta Links For WordPress Plugins" class="liinternal">Set Meta Links For WordPress Plugins</a></li><li><a
href="http://wpengineer.com/key-of-our-success/" rel="bookmark" title="Permanent Link: Key Of Our Success?" class="liinternal">Key Of Our Success?</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><li><a
href="http://wpengineer.com/list-all-subcategories/" rel="bookmark" title="Permanent Link: List All Subcategories" class="liinternal">List All Subcategories</a></li><li><a
href="http://wpengineer.com/wordpress-outlook-2009/" rel="bookmark" title="Permanent Link: WordPress &#8211; An Outlook For 2009" class="liinternal">WordPress &#8211; An Outlook For 2009</a></li></ul><hr
/><p><img
style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a
href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br
/> &copy; <a
href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p> ]]></content:encoded> <wfw:commentRss>http://wpengineer.com/how-to-improve-wordpress-plugins/feed/</wfw:commentRss> <slash:comments>16</slash:comments> </item> <item><title>Add WordPress Dashboard Widgets</title><link>http://wpengineer.com/add-wordpress-dashboard-widgets/</link> <comments>http://wpengineer.com/add-wordpress-dashboard-widgets/#comments</comments> <pubDate>Mon, 27 Oct 2008 01:49:05 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[PHP]]></category> <category><![CDATA[Plugin]]></category> <category><![CDATA[Theme]]></category> <category><![CDATA[Widget]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[WordPress Tutorials]]></category> <category><![CDATA[WP]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=307</guid> <description><![CDATA[Finally WordPress 2.7 is coming along with widgets in the dashboard area, so it will be possible to adjust your dashboard as you like. For Plugin or theme authors it's even more interesting, since they can give the users additional value to their Plugins. They can offer information from their Plugin directly on the dashboard. [...]]]></description> <content:encoded><![CDATA[<p>Finally WordPress 2.7 is coming along with widgets in the dashboard area, so it will be possible to adjust your dashboard as you like.</p><p>For Plugin or theme authors it's even more interesting, since they can give the users additional value to their Plugins. They can offer information from their Plugin directly on the dashboard. The user can decide if he likes to display them or not.</p><p>It's easy to integrate and can be controlled like <a
href="http://wpengineer.com/use-metaboxes-in-your-theme-or-plugin/" class="liinternal">Meta Boxes (explained in detail)</a>. The following example shows how you can integrate a widget in a dashboard.<br
/> <span
id="more-307"></span></p> </pre><p><div
id="attachment_308" class="wp-caption aligncenter" style="width: 460px"><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27-dashboard-erweitern.png" alt="WP 2.7 with new Widget in Dashboard" title="wp27-dashboard-expand" width="450" height="308" class="size-full wp-image-308" /><p
class="wp-caption-text">WP 2.7 with new Widget in Dashboard</p></div></p><p>The above screenshot shows that I addes the widget <em>Test My Dashboard</em>. Also you can see the possibility to deactivate the widget in the menu.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #009933; font-style: italic;">/**
 * Content of Dashboard-Widget
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> my_wp_dashboard_test<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	<span style="color: #b1b100;">echo</span> <span style="color: #0000ff;">'Test Add Dashboard-Widget'</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #009933; font-style: italic;">/**
 * add Dashboard Widget via function wp_add_dashboard_widget()
 */</span>
<span style="color: #000000; font-weight: bold;">function</span> my_wp_dashboard_setup<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
	wp_add_dashboard_widget<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'my_wp_dashboard_test'</span><span style="color: #339933;">,</span> __<span style="color: #009900;">&#40;</span> <span style="color: #0000ff;">'Test My Dashboard'</span> <span style="color: #009900;">&#41;</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_wp_dashboard_test'</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;">/**
 * use hook, to integrate new widget
 */</span>
add_action<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'wp_dashboard_setup'</span><span style="color: #339933;">,</span> <span style="color: #0000ff;">'my_wp_dashboard_setup'</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>The function <code>wp_add_dashboard_widget()</code> is the key, which delivers the new widget; via hook <code>wp_dashboard_setup</code> it will be activated on the dashboard.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">function</span> wp_add_dashboard_widget<span style="color: #009900;">&#40;</span> <span style="color: #000088;">$widget_id</span><span style="color: #339933;">,</span> <span style="color: #000088;">$widget_name</span><span style="color: #339933;">,</span> <span style="color: #000088;">$callback</span><span style="color: #339933;">,</span> <span style="color: #000088;">$control_callback</span> <span style="color: #339933;">=</span> <span style="color: #009900; font-weight: bold;">null</span> <span style="color: #009900;">&#41;</span></pre></div></div><p>The function needs 3 parameters and an additional one is optional.</p><ol><li>The <strong>ID</strong>, <em>first parameter</em>,will be used to deactivate the widget via JavaScript. In the Menu:<div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>label <span style="color: #b1b100;">for</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;my_wp_dashboard_test-hide&quot;</span><span style="color: #339933;">&gt;&lt;</span>input <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;hide-postbox-tog&quot;</span> name<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;my_wp_dashboard_test-hide&quot;</span> type<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checkbox&quot;</span> id<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;my_wp_dashboard_test-hide&quot;</span> value<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;my_wp_dashboard_test&quot;</span> checked<span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;checked&quot;</span> <span style="color: #339933;">/&gt;</span>Test My Dashboard<span style="color: #339933;">&lt;/</span>label<span style="color: #339933;">&gt;</span></pre></div></div><p>and also in the widget:</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;my_wp_dashboard_test&quot;</span> <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;postbox &quot;</span> <span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>h3 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'hndle'</span><span style="color: #339933;">&gt;&lt;</span>span<span style="color: #339933;">&gt;</span>Test My Dashboard<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>h3<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;</span>div <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">&quot;inside&quot;</span><span style="color: #339933;">&gt;</span>Test Add Dashboard<span style="color: #339933;">-</span>Widget<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span>
<span style="color: #339933;">&lt;/</span>div<span style="color: #339933;">&gt;</span></pre></div></div></li><li>The <em>second parameter</em> delivers the <strong>name</strong>, which will be displayed, wrapped in an h3-tag.<div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #339933;">&lt;</span>h3 <span style="color: #000000; font-weight: bold;">class</span><span style="color: #339933;">=</span><span style="color: #0000ff;">'hndle'</span><span style="color: #339933;">&gt;&lt;</span>span<span style="color: #339933;">&gt;</span>Test My Dashboard<span style="color: #339933;">&lt;/</span>span<span style="color: #339933;">&gt;&lt;/</span>h3<span style="color: #339933;">&gt;</span></pre></div></div></li><li>With the help of the <em>third parameter</em> the third <strong>function</strong> gets delivered, it contains the content of the widget. The <code>echo</code> does not take place, you have to use it explicitly. Therefore not only the content can be displayed, which makes it more flexible.</li></ol><h4>Hint</h4><p>The hook <code>activity_box_end</code>, which is available since version 2.3, still exists. It adds the content in widget &#8222;<em>Right Now</em>&#8220;.</p><h4>Update</h4><p>Nice to read: a update of this post to include options in the dashboard widget: <a
href="http://rick.jinlabs.com/2009/02/01/how-add-options-to-your-wordpress-27-dashboard-widgets/" class="liexternal">How add options to your WordPress 2.7 dashboard widgets</a><br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/deactivate-wordpress-default-widgets/" rel="bookmark" title="Permanent Link: Deactivate WordPress Default Widgets" class="liinternal">Deactivate WordPress Default Widgets</a></li><li><a
href="http://wpengineer.com/new-navi-design-in-wordpress-27/" rel="bookmark" title="Permanent Link: New Navi-Design in WordPress 2.7" class="liinternal">New Navi-Design in WordPress 2.7</a></li><li><a
href="http://wpengineer.com/recents-drafts-all-authors/" rel="bookmark" title="Permanent Link: Recents Drafts All Authors" class="liinternal">Recents Drafts All Authors</a></li><li><a
href="http://wpengineer.com/wordpress-admin-ui-ideas/" rel="bookmark" title="Permanent Link: WordPress Admin UI Ideas" class="liinternal">WordPress Admin UI Ideas</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></ul><hr
/><p><img
style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a
href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br
/> &copy; <a
href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p> ]]></content:encoded> <wfw:commentRss>http://wpengineer.com/add-wordpress-dashboard-widgets/feed/</wfw:commentRss> <slash:comments>34</slash:comments> </item> <item><title>Strange Things With Sticky Posts</title><link>http://wpengineer.com/strange-things-with-sticky-posts/</link> <comments>http://wpengineer.com/strange-things-with-sticky-posts/#comments</comments> <pubDate>Wed, 22 Oct 2008 04:28:14 +0000</pubDate> <dc:creator>Michael</dc:creator> <category><![CDATA[WordPress Hacks]]></category> <category><![CDATA[conditional tag]]></category> <category><![CDATA[sticky]]></category> <category><![CDATA[template tag]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=293</guid> <description><![CDATA[Frank wrote in one of his last posts about the new sticky functionality in WordPress 2.7. Right now I'm working on a special theme and I noticed some strange things with sticky posts. Wrong Post Count If you like to show 6 posts on a page, I use query_posts('showposts=6');. But if one or more posts [...]]]></description> <content:encoded><![CDATA[<p>Frank wrote in one of his last posts about the new <a
href="http://wpengineer.com/sticky-function-in-wordpress-27/" title="sticky function in WordPress 2.7" class="liinternal">sticky functionality</a> in WordPress 2.7. Right now I'm working on a special theme and I noticed some strange things with sticky posts.<br
/> <span
id="more-293"></span></p><h3>Wrong Post Count</h3><p>If you like to show 6 posts on a page, I use <code>query_posts('showposts=6');</code>. But if one or more posts are "sticky", they get added to the other 6 posts. To show 6 posts actually, you have to know how many sticky posts you have.</p><p><strong>The solution:</strong></p><p><code>get_option('sticky_post')</code> gives you an array back with sticky post ID, which we can count.</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;"><span style="color: #000088;">$sticky</span> <span style="color: #339933;">=</span> <span style="color: #990000;">count</span><span style="color: #009900;">&#40;</span>get_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sticky_posts'</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span> 
query_posts<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'showposts='</span><span style="color: #339933;">.</span> <span style="color: #009900;">&#40;</span> <span style="color: #cc66cc;">6</span> <span style="color: #339933;">-</span> <span style="color: #000088;">$sticky</span> <span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><h3>Still showing sticky posts in chronological sort order</h3><p>Pay attention to the CSS classes of the posts. The template tag <code>post_class()</code> gives the post the class. In the case of sticky post, it is also the class "sticky". If you think you can give the class sticky a red background and black border to have a nice teaser you will be disappointed. If you go to the next page to see previous posts, the sticky post will also be showed in the chronological order with a red background and black borders. Not really cool.</p><h3>Kill the Sticky</h3><p>If you don't want to have sticky posts, just write in your template:</p><div
class="wp_syntax"><div
class="code"><pre class="php" style="font-family:monospace;">update_option<span style="color: #009900;">&#40;</span><span style="color: #0000ff;">'sticky_posts'</span><span style="color: #339933;">,</span> <span style="color: #990000;">array</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span></pre></div></div><p>With the empty array you overwrite the sticky options and no sticky posts are availably.</p><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/sticky-function-in-wordpress-27/" rel="bookmark" title="Permanent Link: Sticky Function in WordPress 2.7" class="liinternal">Sticky Function in WordPress 2.7</a></li><li><a
href="http://wpengineer.com/correct-pagination-with-get_posts/" rel="bookmark" title="Permanent Link: Correct Pagination with get_posts" class="liinternal">Correct Pagination with get_posts</a></li><li><a
href="http://wpengineer.com/the-ultimative-guide-for-the_post_thumbnail-in-wordpress-2-9/" rel="bookmark" title="Permanent Link: The Ultimative Guide For the_post_thumbnail In WordPress 2.9" class="liinternal">The Ultimative Guide For the_post_thumbnail In WordPress 2.9</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><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></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/strange-things-with-sticky-posts/feed/</wfw:commentRss> <slash:comments>9</slash:comments> </item> <item><title>New Navi-Design in WordPress 2.7</title><link>http://wpengineer.com/new-navi-design-in-wordpress-27/</link> <comments>http://wpengineer.com/new-navi-design-in-wordpress-27/#comments</comments> <pubDate>Tue, 14 Oct 2008 10:14:54 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress News]]></category> <category><![CDATA[backend]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=262</guid> <description><![CDATA[The Design and structure of the coming WordPress version 2.7 were presented several times already and discussed many times. Here are the new structure how the navigation design looks in WordPress 2.7, your thoughts? Update The new Design, today (29/10/2008) in beta. Related posts: Use More Flexibility In WordPress Templates Easy Breadcrumb Navi With WordPress [...]]]></description> <content:encoded><![CDATA[<p>The Design and structure of the coming WordPress version 2.7 were presented several times already and discussed many times. Here are the new structure how the navigation design looks in WordPress 2.7, your thoughts?</p><p><div
id="attachment_263" class="wp-caption aligncenter" style="width: 510px"><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27_navi.png" alt="WP 2.7 Navi. actually Beta" title="wp27_navi" width="500" height="327" class="size-full wp-image-263" /><p
class="wp-caption-text">WP 2.7 Navi. actually Beta</p></div></p><h4>Update</h4><p>The new Design, today (29/10/2008) in beta.<br
/><div
id="attachment_308" class="wp-caption aligncenter" style="width: 460px"><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27-dashboard-erweitern.png" alt="WP 2.7 with new Widget in Dashboard" title="wp27-dashboard-erweitern" width="450" height="247" class="size-full wp-image-308" /><p
class="wp-caption-text">WP 2.7 with new Widget in Dashboard</p></div><br
/><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/use-more-flexibility-in-wordpress-templates/" rel="bookmark" title="Permanent Link: Use More Flexibility In WordPress Templates" class="liinternal">Use More Flexibility In WordPress Templates</a></li><li><a
href="http://wpengineer.com/easy-breadcrumb-navi-with-wordpress/" rel="bookmark" title="Permanent Link: Easy Breadcrumb Navi With WordPress" class="liinternal">Easy Breadcrumb Navi With WordPress</a></li><li><a
href="http://wpengineer.com/wordpress-2-8-single-post-navigation-widget/" rel="bookmark" title="Permanent Link: WordPress 2.8 Single Post Navigation Widget" class="liinternal">WordPress 2.8 Single Post Navigation Widget</a></li><li><a
href="http://wpengineer.com/removing-wordpress-login-design/" rel="bookmark" title="Permanent Link: Removing WordPress Login Design" class="liinternal">Removing WordPress Login Design</a></li><li><a
href="http://wpengineer.com/create-your-own-wordpress-login-design/" rel="bookmark" title="Permanent Link: Create Your Own WordPress Login Design" class="liinternal">Create Your Own WordPress Login Design</a></li></ul><hr
/><p><img
style="float:left;" src="http://wpengineer.com/favicon.ico" alt="WP Engineer Favicon"/> Thanks for subscribing our feed! <a
href="http://buysellads.com/buy/detail/3646/" class="liexternal">Sponsor the WP Engineer Blog</a> and get your brand in front of several hundred users per day!<br
/> &copy; <a
href="http://wpengineer.com/" class="liinternal">WP Engineer Team</a>, All rights reserved <small>(Digital Fingerprint: WPEngineer-be0254ce2b4972feb4b9cb72034a092d)</small></p> ]]></content:encoded> <wfw:commentRss>http://wpengineer.com/new-navi-design-in-wordpress-27/feed/</wfw:commentRss> <slash:comments>4</slash:comments> </item> <item><title>How Core Update in WordPress 2.7 Works?</title><link>http://wpengineer.com/how-core-update-in-wordpress-27-works/</link> <comments>http://wpengineer.com/how-core-update-in-wordpress-27-works/#comments</comments> <pubDate>Tue, 07 Oct 2008 17:57:27 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress News]]></category> <category><![CDATA[update]]></category> <category><![CDATA[WordPress]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=227</guid> <description><![CDATA[In recent days, there are more and more information about WordPress version 2.7 coming up. Especially about the automatic upgrade of WordPress. You already know the update function for Plugins, which is very convenient. Now the same for your WordPress installation, one click and you are up to date. Such a powerful and important function [...]]]></description> <content:encoded><![CDATA[<p>In recent days, there are more and more information about WordPress version 2.7 coming up. Especially about the automatic upgrade of WordPress.</p><p>You already know the update function for Plugins, which is very convenient. Now the same for your WordPress installation, one click and you are up to date.</p><p>Such a powerful and important function comes along with some questions and doubts of course.</p><p><div
id="attachment_221" class="wp-caption aligncenter" style="width: 460px"><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27_core_update.png" alt="WordPress 2.7 Core Update" title="wp27_core_update" width="450" height="260" class="size-full wp-image-221" /><p
class="wp-caption-text">WordPress 2.7 Core Update</p></div></p><p>It's your own decision if you want to trust this function, but it's more secure than the automatic update for Plugins, since the Plugins are provided by different authors without control by the WordPress team. The process of the automatic WordPress update is well thought out, which I will explain, so you can get a better picture of it and it makes your decision easier for you if you want to use it or you still update manually.<br
/> <span
id="more-227"></span></p><ul><li>Your installation sends version and localization to <a
href="http://api.wordpress.org/core/version-check/1.2/" class="liwp">http://api.wordpress.org/core/version-check/1.2/</a> and proofs if there is a newer version available. If there is a newer version, it sends back an address to the new available version. It also sends it in the correct language of your current installation. But right now, there is only the English version.</li><li>If there is a newer version, the files will be downloaded in system-temp.</li><li>Afterwards it creates a folder <code>wp-content/upgrade/core</code></li><li>Now the file <code>wp-admin/includes/update-core.php</code> will be copied from the new download package into the current installation.</li><li>This new file will be used to start the function <code>update_core()</code>.</li><li>The new version will be proved.</li><li>A file will be created in root for the maintain modus (<code>.maintenance</code> file). The file <code>wp-settings.php</code> checks that and avoid any access if this file exists. The visitor will just see a simple HTML page with a short message:<br
/><blockquote><p>Briefly unavailable for scheduled maintenance. Check back in a minute.</p></blockquote></li><li>Because of this maintain modus no one can access any files and now all files are getting copied from the installation package to the current installation.</li><li>All unneeded files are going to be deleted.</li><li><code>ugrade.php</code> contains the information, that the database can be upgraded now. You have to confirm the database update, so it is only possible after all new files are copied to the current installation.</li><li><code>wp-content/upgrade/core</code> will be deleted after a successful update.</li><li>The same with <code>.maintenance</code>.</li><li>After that the frontend is available again and all upgrade steps are listed in your admin area. Where you can see where a problem occurred if your upgrade wasn't successful.</li></ul><hr
/><h3>Related posts:</h3><ul><li><a
href="http://wpengineer.com/disable-wordpress-feed/" rel="bookmark" title="Permanent Link: Disable WordPress Feed" class="liinternal">Disable WordPress Feed</a></li><li><a
href="http://wpengineer.com/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/use-wordpress-27-offline/" rel="bookmark" title="Permanent Link: Use WordPress 2.7 Offline" class="liinternal">Use WordPress 2.7 Offline</a></li><li><a
href="http://wpengineer.com/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/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></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-core-update-in-wordpress-27-works/feed/</wfw:commentRss> <slash:comments>2</slash:comments> </item> <item><title>WordPress 2.7 Update Core</title><link>http://wpengineer.com/wordpress-27-update-core/</link> <comments>http://wpengineer.com/wordpress-27-update-core/#comments</comments> <pubDate>Fri, 03 Oct 2008 23:51:34 +0000</pubDate> <dc:creator>Frank</dc:creator> <category><![CDATA[WordPress News]]></category> <category><![CDATA[core]]></category> <category><![CDATA[update]]></category> <category><![CDATA[wp2.7]]></category><guid
isPermaLink="false">http://wpengineer.com/?p=220</guid> <description><![CDATA[The current development version with the core update is available now. Everybody can test it, the development team ask for your feedback. Everybody who doesn't want to check the SVN might be interested in this screenshot. This function amazed by it's simplicity, click, lean back and relax - done! It's still in Beta and I'm [...]]]></description> <content:encoded><![CDATA[<p>The current development version with the core update is available now. Everybody can test it, the development team ask for your feedback. Everybody who doesn't want to check the SVN might be interested in this screenshot.</p><p><div
id="attachment_221" class="wp-caption aligncenter" style="width: 460px"><img
src="http://wpengineer.com/blog/wp-content/uploads/wp27_core_update.png" alt="WordPress 2.7 Core Update" title="wp27_core_update" width="450" height="260" class="size-full wp-image-221" /><p
class="wp-caption-text">WordPress 2.7 Core Update</p></div></p><p>This function amazed by it's simplicity, click, lean back and relax - done! <span
id="more-220"></span><br
/> It's still in Beta and I'm sure many people will talk about the functionality, but that was a popular desire of the WordPress community. Will see if the endless discussion about the upgrade cycles will end or still continue.</p><p>Alternative you can still download the current version and install manually like always . Additional WordPress has to offer an own backup system. This saves the use of other Plugins and an upgrade including a backup is fast and simple. The backup creates a XML-File in WordPress format (WordPress WXR), which you can easily import again. It was greatly appreciated in WP-Hacker forum that you can find this function under tools.<br
/><hr
/><h3>Related posts:</h3><ul><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/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/use-wordpress-27-offline/" rel="bookmark" title="Permanent Link: Use WordPress 2.7 Offline" class="liinternal">Use WordPress 2.7 Offline</a></li><li><a
href="http://wpengineer.com/disable-wordpress-feed/" rel="bookmark" title="Permanent Link: Disable WordPress Feed" class="liinternal">Disable WordPress Feed</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></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-27-update-core/feed/</wfw:commentRss> <slash:comments>0</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 42/119 queries in 0.974 seconds using disk
Object Caching 2933/3144 objects using disk

Served from: wpengineer.com @ 2010-07-29 13:11:02 -->