CINXE.COM

Mark on WordPress

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="en"> <!-- generated 153 seconds ago generated in 0.505 seconds served from batcache in 0.003 seconds expires in 147 seconds --> <head profile="http://gmpg.org/xfn/11"><script type="text/javascript" src="/_static/js/bundle-playback.js?v=HxkREWBo" charset="utf-8"></script> <script type="text/javascript" src="/_static/js/wombat.js?v=txqj7nKC" charset="utf-8"></script> <script>window.RufflePlayer=window.RufflePlayer||{};window.RufflePlayer.config={"autoplay":"on","unmuteOverlay":"hidden"};</script> <script type="text/javascript" src="/_static/js/ruffle/ruffle.js"></script> <script type="text/javascript"> __wm.init("https://web.archive.org/web"); __wm.wombat("http://markjaquith.wordpress.com:80/?","20100825003651","https://web.archive.org/","web","/_static/", "1282696611"); </script> <link rel="stylesheet" type="text/css" href="/_static/css/banner-styles.css?v=S1zqJCYt" /> <link rel="stylesheet" type="text/css" href="/_static/css/iconochive.css?v=3PDvdIFv" /> <!-- End Wayback Rewrite JS Include --> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> <title> Mark on WordPress</title> <link rel="stylesheet" href="https://web.archive.org/web/20100825003651cs_/http://s2.wp.com/wp-content/themes/pub/journalist/style.css?m=1277217999g" type="text/css" media="screen"/> <!--[if IE 6]> <link rel="stylesheet" href="http://s2.wp.com/wp-content/themes/pub/journalist/ie6.css?m=1270837707g" type="text/css" media="screen" /> <![endif]--> <link rel="alternate" type="application/rss+xml" title="Mark on WordPress RSS Feed" href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/feed/"/> <link rel="pingback" href="http://markjaquith.wordpress.com/xmlrpc.php"/> <script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://use.typekit.com/mfg1dlk.js"></script> <script type="text/javascript">try{Typekit.load();}catch(e){}</script> <script type="text/javascript"> /* <![CDATA[ */ function addLoadEvent(func){var oldonload=window.onload;if(typeof window.onload!='function'){window.onload=func;}else{window.onload=function(){oldonload();func();}}} /* ]]> */ </script> <link rel="stylesheet" href="https://web.archive.org/web/20100825003651cs_/http://s0.wp.com/wp-content/themes/h4/global.css?m=1256671583g" type="text/css"/> <link rel="EditURI" type="application/rsd+xml" title="RSD" href="http://markjaquith.wordpress.com/xmlrpc.php?rsd"/> <link rel="wlwmanifest" type="application/wlwmanifest+xml" href="http://markjaquith.wordpress.com/wp-includes/wlwmanifest.xml"/> <link rel="index" title="Mark on WordPress" href="http://markjaquith.wordpress.com/"/> <meta name="generator" content="WordPress.com"/> <link rel="shortlink" href="https://web.archive.org/web/20100825003651/http://wp.me/56"/> <script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://s0.videopress.com/js/swfobject.js"></script><script type="text/javascript">swfobject.registerObject('video0','10.0.0','https://web.archive.org/web/20100825003651/http://s0.videopress.com/expressInstall.swf');swfobject.registerObject('video1','10.0.0','https://web.archive.org/web/20100825003651/http://s0.videopress.com/expressInstall.swf');</script><link rel="shortcut icon" type="image/x-icon" href="https://web.archive.org/web/20100825003651im_/http://0.gravatar.com/blavatar/e1868f2458e81a2c5454586dd4077539?s=16&amp;d=http://s2.wp.com/i/favicon.ico"/> <link rel="icon" type="image/x-icon" href="https://web.archive.org/web/20100825003651im_/http://0.gravatar.com/blavatar/e1868f2458e81a2c5454586dd4077539?s=16&amp;d=http://s2.wp.com/i/favicon.ico"/> <link rel="apple-touch-icon" href="https://web.archive.org/web/20100825003651im_/http://1.gravatar.com/blavatar/5bc2cda9e3556be7753b79c4d5700a93?s=158&amp;d=http://s0.wp.com/wp-content/themes/h4/i/webclip.png"/> <style type="text/css"> /* <![CDATA[ */ div#likes { margin-top: 15px; } .like-button { border: 1px solid #eee; padding: 2px 6px; font-size: 13px; font-family: arial, tahoma, sans-serif; } #wpl-likebox { clear: left; font-size: 11px; font-family: arial, tahoma, verdana, sans-serif !important; min-height: 30px; margin: 10px 0 !important; padding: 5px 0 10px 0 !important; } #wpl-button { float: left; background: url( /web/20100825003651im_/http://markjaquith.wordpress.com/i/buttonbg.png ) top left repeat-x; margin-right: 7px; border: 1px solid #d4d4d4; -moz-border-radius: 3px; -webkit-border-radius: 3px; border-radius: 3px; } #wpl-button a { color: #666 !important; line-height: 130% !important; text-decoration: none !important; outline: none; float: left; padding: 3px 6px 2px 24px !important; font-size: 11px !important; background: url( /web/20100825003651im_/http://markjaquith.wordpress.com/i/likestar.png ) 6px 49.8% no-repeat; } #wpl-button.liked { background: #feffce; border: 1px solid #f3e389; } #wpl-button.liked a { color: #ba871b !important; } #wpl-likebox #wpl-count { min-height: 25px; line-height: 130% !important; float: left; padding-top: 4px; } #wpl-likebox #wpl-avatars { clear: left; max-height: 98px; overflow: hidden; margin-top: 15px; line-height: 130% !important; } #wpl-likebox #wpl-avatars img { border: none !important; } /* ]]> */ </style> <link rel="openid.server" href="http://markjaquith.wordpress.com/?openidserver=1"/> <link rel="openid.delegate" href="http://markjaquith.wordpress.com/"/> <link rel="search" type="application/opensearchdescription+xml" href="https://web.archive.org/web/20100825003651/http://wordpress.com/opensearch.xml" title="WordPress.com"/> <link rel="search" type="application/opensearchdescription+xml" href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/osd.xml" title="Mark on WordPress"/> <link rel="stylesheet" type="text/css" href="https://web.archive.org/web/20100825003651cs_/http://markjaquith.wordpress.com/?custom-css=1&amp;csblog=56&amp;cscache=5&amp;csrev=2"/> </head> <body> <div id="container" class="group"> <h1><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/">Mark on WordPress</a></h1> <div id="bubble"><p>WordPress puts food on my table.</p></div> <!-- erase this line if you want to turn the bubble off --> <div id="content" class="group"> <div class="post-519 post type-post hentry category-wordpress tag-wordpress tag-apc tag-batcache tag-memcached tag-object-cache tag-caching"> <h2 id="post-519"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/08/06/apc-object-cache-backend-for-wordpress/" rel="bookmark">APC Object Cache Backend for&nbsp;WordPress</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/08/06/apc-object-cache-backend-for-wordpress/#comments">with 15 comments</a></p> <div class="main"> <div class="snap_preview"><p>I wrote the original APC Object Cache backend for WordPress back in 2006. Shared it via a link on the wp-hackers list, and until a few days ago, hadn&#8217;t touched it since.</p> <p>It has <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/apc/">now been updated to version 2.0.1</a>, and should work more efficiently. It supports increment/decrement, and you can now use it to power <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/batcache/">Batcache</a>, the whole-page caching engine used on WordPress.com! In fact, for single-server sites, it should perform a lot better than Batcache + Memcached (because Memcached is a separate application and connections from PHP have some latency).</p> <p>If you have no idea what I&#8217;m talking about, read on.</p> <p>WordPress has a built-in object caching API. It is usually used to store complex data objects or HTML structures which are computationally expensive to create on the fly. By default, the engine is implemented in PHP memory. That means that objects don&#8217;t persist in-between requests. The only benefit there is if you&#8217;re accessing the same objects multiple times on one request.</p> <p>Enter persistent object cache backends. These backends store the data objects between page loads, which saves your server a lot of time and speeds up the user experience. APC is both an opcode cache (which speeds up PHP in general) and an in-memory key/value store which persists between page loads. If you have it installed (or can install it), I highly recommend that you do so. Unfortunately this probably won&#8217;t be available to anyone on shared hosting — VPS/dedicated only. Once you have APC up and running, as confirmed by <code>phpinfo();</code>, install the <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/apc/">APC Object Cache</a> in your WordPress content directory. It is a special kind of plugin, and will not work if placed anywhere else. It also needs to keep its name: <code>object-cache.php</code></p> <p>You should notice improved page load times! I&#8217;ve seen it improve page generation time 10x.</p> <p>And what about Batcache? Batcache is a whole-page or &#8220;HTML output&#8221; caching engine. It stores complete web pages and saves them for later. It <strong>needs</strong> a persistent object cache backend to function. Furthermore, it needs an object cache backend that supports incrementation (counters, to measure how much traffic each URL is getting), and that does its own object expiration. Memcached has fit the bill, and is the preferred solution for multi-web-server WordPress installs. Now with the new version of the APC Object Cache, there is a preferred single server solution as well.</p> <p>Note: W3 Total Cache users need not apply — it handles its own object caching, including support for APC.</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>August 6, 2010 at 11:21 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/apc/" rel="tag">APC</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/batcache/" rel="tag">Batcache</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/memcached/" rel="tag">Memcached</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/object-cache/" rel="tag">object cache</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/caching/" rel="tag">caching</a></p></div> </div> </div> <div class="post-508 post type-post hentry category-wordpress"> <h2 id="post-508"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/27/bookmarklet-to-install-a-wordpress-plugin/" rel="bookmark">Bookmarklet to install a WordPress&nbsp;Plugin</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/27/bookmarklet-to-install-a-wordpress-plugin/#comments">with 12 comments</a></p> <div class="main"> <div class="snap_preview"><p>As a followup to <a href="/web/20100825003651/http://markjaquith.wordpress.com/2010/07/24/plugin-installer-tool/">my previous post</a>, I&#8217;ve <a href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/wp-plugin-install/">created a bookmarklet</a> that you can use to install a WordPress plugin. While viewing a plugin in the WordPress Plugin Directory, click this bookmarklet, and you&#8217;ll be guided in installing that plugin on your site.</p> <p>Here&#8217;s a screencast showing it in action!</p> <div id="x-video-0" class="video-player"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="700" height="548" id="video0" standby="WordPress Plugin Installation Bookmarklet"> <param name="movie" value="http://s0.videopress.com/player.swf?v=1.02"/> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=8RH01Wig&amp;javascriptid=video0"/> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="https://web.archive.org/web/20100825003651im_/http://s0.videopress.com/player.swf?v=1.02" width="700" height="548" standby="WordPress Plugin Installation Bookmarklet"> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=8RH01Wig&amp;javascriptid=video0"/> <!--<![endif]--> <img alt="WordPress Plugin Installation Bookmarklet" src="https://web.archive.org/web/20100825003651im_/http://videos.videopress.com/8RH01Wig/wp-plugin-install-bookmarklet_std.original.jpg" width="700" height="548"/><p><strong>WordPress Plugin Installation Bookmarklet</strong></p><p class="robots-nocontent">This movie requires <a rel="nofollow" href="https://web.archive.org/web/20100825003651/http://www.adobe.com/go/getflashplayer">Adobe Flash</a> for playback.</p> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 27, 2010 at 3:59 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> </div> </div> </div> <div class="post-498 post type-post hentry category-wordpress tag-installation tag-plugin tag-tool"> <h2 id="post-498"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/24/plugin-installer-tool/" rel="bookmark">Plugin installer&nbsp;tool</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/24/plugin-installer-tool/#comments">with 41 comments</a></p> <div class="main"> <div class="snap_preview"><p>Remember when you had to install WordPress plugins by uploading them manually via FTP? I do. Heck, I remember when there weren&#8217;t plugins, and you had to copy and paste PHP code! We&#8217;ve come a long way, but I realized the other day that there is one more way that we could improve ease of installation.</p> <p>Say you&#8217;re a plugin author, and you have this great plugin. How do you get people to install it? Well, you could link to its page in the plugin directory, where they&#8217;d be prompted to download a zip file. Or you could offer the zip file yourself. But why are we offering plugins the same way we were in 2004? We have a built-in plugin installer. Let&#8217;s use that! So how would you do that? I guess you&#8217;d just tell people &#8220;Hey, go to your wp-admin and search for &#8216;My Awesome Plugin.&#8217;&#8221; That introduces a lot of chances for failure. They might even end up with the wrong plugin!</p> <p>I made a better way, and will be working on integrating this into WordPress.org this summer.</p> <p>To see it in action, <a href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/wp-plugin-install/?plugin=category-checklist-expander">click here</a>. All you have to do is type in the URL of your WordPress blog.</p> <p><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2010/07/screen-shot-2010-07-24-at-8-08-09-pm.png?w=700&amp;h=278" alt="" title="Screen shot 2010-07-24 at 8.08.09 PM" width="700" height="278" class="aligncenter size-large wp-image-501"/></p> <p>The tool auto-detects the WordPress installation by looking at the X-Pingback header. You&#8217;ll be presented with the plugin installation form for your blog. Click &#8220;Install Now&#8221; and the plugin will be installed. Much easier, and you know they&#8217;re getting the correct plugin.</p> <p><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2010/07/screen-shot-2010-07-24-at-8-33-52-pm.png?w=700&amp;h=395" alt="" title="Screen shot 2010-07-24 at 8.33.52 PM" width="700" height="395" class="aligncenter size-large wp-image-502"/></p> <p>Plugin authors can <a href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/wp-plugin-install/">go here</a> for more info. I&#8217;ll make sure these URLs forward to WordPress.org once we get it set up there, so you can start using this now.</p> <p><strong>Update:</strong> It has <a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/24/plugin-installer-tool/">a bookmarklet</a> now. If you click that bookmarklet from a WordPress Plugin Directory page, it&#8217;ll prompt you to install the plugin you were viewing.</p> <p>Here&#8217;s a screencast showing it in action!</p> <div id="x-video-1" class="video-player"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="700" height="548" id="video1" standby="WordPress Plugin Installation Bookmarklet"> <param name="movie" value="http://s0.videopress.com/player.swf?v=1.02"/> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=8RH01Wig&amp;javascriptid=video1"/> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="https://web.archive.org/web/20100825003651im_/http://s0.videopress.com/player.swf?v=1.02" width="700" height="548" standby="WordPress Plugin Installation Bookmarklet"> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=8RH01Wig&amp;javascriptid=video1"/> <!--<![endif]--> <img alt="WordPress Plugin Installation Bookmarklet" src="https://web.archive.org/web/20100825003651im_/http://videos.videopress.com/8RH01Wig/wp-plugin-install-bookmarklet_std.original.jpg" width="700" height="548"/><p><strong>WordPress Plugin Installation Bookmarklet</strong></p><p class="robots-nocontent">This movie requires <a rel="nofollow" href="https://web.archive.org/web/20100825003651/http://www.adobe.com/go/getflashplayer">Adobe Flash</a> for playback.</p> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 24, 2010 at 8:39 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/installation/" rel="tag">installation</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/plugin/" rel="tag">plugin</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/tool/" rel="tag">tool</a></p></div> </div> </div> <div class="post-493 post type-post hentry category-ask-wordpress category-wordpress"> <h2 id="post-493"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/19/wordpress-question-answer-july-19th-2010/" rel="bookmark">WordPress Q &amp; A: Week of July 19th,&nbsp;2010</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/19/wordpress-question-answer-july-19th-2010/#comments">with 12 comments</a></p> <div class="main"> <div class="snap_preview"><h4>Iva asks:</h4> <blockquote><p>For us who use shared/clustered hosting solutions, there a good and free way to run WordPress 3.0 with a couple of sub-sites using more than one database?</p></blockquote> <p>Check out <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/hyperdb/">HyperDB</a>. It does exactly this!</p> <h4>Paul asks:</h4> <blockquote><p>How can someone make sure that their theme is compatible with the latest WordPress version?</p></blockquote> <p>I presume Paul is asking this from a user perspective. If your theme is simple, there is only a very small chance that a WordPress upgrade will break it. This rarely happens. Plugins and advanced themes (which behave as plugins) break at a slightly higher (but still very low) rate. This has to do with how well they were coded, for the most part. If the author is using our documented public functions, it is probably fine. If they are making direct queries or using deprecated functions, it might be a problem. You can ask the author this question directly, but it would probably be faster to just throw the theme up on a fresh WordPress install (of the new WP version). For important sites, it doesn&#8217;t hurt to have a test site where you test your plugins and themes with new WP versions. That should give you more peace of mind about upgrading.</p> <h4>Kieron asks:</h4> <blockquote><p>How do I change the number of posts shown in a category? Currently there are 10 but I am using 3 posts in a row so I either want to display 12 or 9 to make it look okay.</p></blockquote> <p>The WordPress posts per page setting is global, but plugins can alter it based on the type of page you&#8217;re viewing (or any other criterion). The <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/cbnet-different-posts-per-page/">Different Posts per Page</a> plugin looks the ticket! For people looking to do this in code, try this as a base:</p> <pre class="brush: php;"> function my_custom_posts_per_page( &amp;$q ) { if ( $q-&gt;is_category ) $q-&gt;set( 'posts_per_page', 12 ); /* You can also test things like: $q-&gt;is_search, $q-&gt;is_author, $q-&gt;is_year, etc Look in the WP_Query class for the full list of variables Also note that you can change the ordering! */ return $q; } add_filter('parse_query', 'my_custom_posts_per_page'); </pre> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 19, 2010 at 1:11 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/ask-wordpress/" title="View all posts in Ask WordPress" rel="category tag">Ask WordPress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> </div> </div> </div> <div class="post-464 post type-post hentry category-wordpress tag-wordpress tag-themes tag-gpl tag-thesis tag-license-2"> <h2 id="post-464"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/17/why-wordpress-themes-are-derivative-of-wordpress/" rel="bookmark">Why WordPress Themes are Derivative&nbsp;of WordPress</a></h2> <div class="main"> <div class="snap_preview"><p>In the past few days, WordPress has become entangled in a debate about WordPress theme licensing. It was specifically centered around Thesis, one of the last notable proprietary theme holdouts. Chris Pearson, who develops and sells Thesis, refuses to license Thesis under the GNU General Public License that applies to WordPress and all WordPress-derived code.</p> <p>There are many aspects to the ongoing WordPress vs. Thesis brouhaha. Things like respect, copyright, freedom, GPL, ownership. There is <a href="https://web.archive.org/web/20100825003651/http://drewblas.com/2010/07/15/an-analysis-of-gpled-code-in-thesis/">no doubt</a> that Thesis lifted lines of code, and even whole sections of code, directly from WordPress. The Thesis developer who did some of the lifting <a href="https://web.archive.org/web/20100825003651/http://ma.tt/2010/07/syn-thesis-1/#comment-481845">confessed to it</a> (much to his credit).</p> <p>Some people have changed their opinion on the matter when they learned of that wholesale code copying. That is, they changed their mind about Thesis specifically. But those revelations happened later in the fray, after Chris Pearson and Matt Mullenweg&#8217;s <a href="https://web.archive.org/web/20100825003651/http://mixergy.com/chris-pearson-matt-mullenweg/">discussion on Mixergy</a> about the matter. It is the position of the WordPress core developers that themes cannot be considered wholly original creations even when they don&#8217;t copy large sections of code in from WordPress. <strong>Theme code necessarily derives from WordPress and thus must be licensed under the GPL if it is distributed.</strong></p> <h3>What is a WordPress theme?</h3> <p>WordPress themes are a collection of PHP files that are loaded together with WordPress and use WordPress functions and access WordPress core data in order to deliver HTML output. A theme may (and almost always does) include CSS files, JavaScript files, and image files. Note that WordPress theme PHP files are not &#8220;templates&#8221; or &#8220;documents&#8221; in the way that most people think of those words (though the word &#8220;template&#8221; is sometimes used, it is not strictly accurate). They are PHP script files that are parsed and run on the same exact level and by the same PHP process as all the core WordPress files.</p> <h3>Is a theme separate from WordPress?</h3> <p>There is a tendency to think that there are two things: WordPress, and the active theme. But they do not run separately. They run as one cohesive unit. They don&#8217;t even run in a sequential order. WordPress starts up, WordPress tells the theme to run its functions and register its hooks and filters, then WordPress runs some queries, then WordPress calls the appropriate theme PHP file, and then the theme hooks into the queried WordPress data and uses WordPress functions to display it, and then WordPress shuts down and finishes the request. On that simple view, it looks like a multi-layered sandwich. But the integration is even more amalgamated than the sandwich analogy suggests.</p> <p>Here is one important takeaway: <strong>themes interact with WordPress (and WordPress with themes) the exact same way that WordPress interacts with itself.</strong> Give that a second read, and then we&#8217;ll digest.</p> <p>The same core WordPress functions that themes use are used by WordPress itself. The same action/filter hook system that themes use is used by WordPress itself. Themes can thus disable core WordPress functionality, or modify WordPress core data. Not just take WordPress&#8217; ultimate output and change it, but actually reach into the internals of WordPress and change those values before WordPress is finished working with them. If you were thinking that theme code is a separate work because it is contained in a separate file, also consider that many core WordPress files work the same way. They define functions, they use the WordPress hook system to insert themselves at various places in the code, they perform various functions on their own but also interact with the rest of WordPress, etc. No one would argue that these core files don&#8217;t have to be licensed under the GPL — but they operate in the same way that themes do!</p> <p>It isn&#8217;t correct to think of WordPress and a theme as separate entities. As far as the code is concerned, they form one functional unit. The theme code doesn&#8217;t sit &#8220;on top of&#8221; WordPress. It is within it, in multiple different places, with multiple interdependencies. This forms a web of shared data structures and code all contained within a shared memory space. If you followed the code execution for Thesis as it jumped between WordPress core code and Thesis-specific code, you&#8217;d get a headache, because you&#8217;d be jumping back and forth literally hundreds of times. But that is an artificial distinction that you&#8217;d only be aware of based on which file contained a particular function. To the PHP parser, it is all one and the same. There isn&#8217;t WordPress core code and theme code. There is merely the resulting product, which parses as one code entity.</p> <h3>But it&#8217;s still in separate files!</h3> <p>I don&#8217;t think that matters. Linux Kernel Modules likewise are in separate files, but they&#8217;re considered by most <a href="https://web.archive.org/web/20100825003651/http://ryan.boren.me/2010/07/15/wordpress-theme-licensing/">to be derivative</a>. If that argument doesn&#8217;t convince you, then note that the vast majority of themes derive from the original WordPress core themes. How they load different PHP subfiles, loop through posts, and get and interact with WordPress data is all covered by the original WordPress core themes, which are explicitly GPL. But I don&#8217;t think we need to resort to that argument, because of the way that themes combine with WordPress to form a modified work.</p> <h3>On APIs</h3> <p>WordPress has many external APIs that spit out data. Interacting with these APIs does <strong>not</strong> put your code on the same level as core WordPress code. These APIs include Atom, RSS, AtomPub, and XML-RPC. Something that interacts with these APIs sits entirely outside of WordPress. Google Reader doesn&#8217;t become part of WordPress by accessing your feed, and MarsEdit doesn&#8217;t become part of WordPress when you use it to publish a post on your WordPress blog. These are separate applications, running separately, on separate codebases. All they are doing is communicating. Applications that interact with WordPress this way are separate works, and the author can license them in any way they have authority to do so.</p> <p>This is a wholly different model of interaction than with themes. Themes are not standalone applications. They are scripts that become part of WordPress itself, and interact with WordPress on the same level that WordPress interacts with itself.</p> <h3>Not just our opinion</h3> <p>Drupal and Joomla, both GPL PHP web publishing applications, have come to the same conclusion. To quote from <a href="https://web.archive.org/web/20100825003651/http://drupal.org/licensing/faq#q7">Drupal</a>:</p> <blockquote><p>Drupal modules and themes are a derivative work of Drupal. If you distribute them, you must do so under the terms of the GPL version 2 or later.</p></blockquote> <p>The Software Freedom Law Center <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/news/2009/07/themes-are-gpl-too/">did a specific analysis</a> of the WordPress theme system and determined that WordPress theme code must inherit the GPL.</p> <blockquote><p>The PHP elements, taken together, are clearly derivative of WordPress code. The template is loaded via the include() function. Its contents are combined with the WordPress code in memory to be processed by PHP along with (and completely indistinguishable from) the rest of WordPress. The PHP code consists largely of calls to WordPress functions and sparse, minimal logic to control which WordPress functions are accessed and how many times they will be called. They are derivative of WordPress because every part of them is determined by the content of the WordPress functions they call. As works of authorship, they are designed only to be combined with WordPress into a larger work.</p></blockquote> <p>This is also the interpretation of the Free Software Foundation, <strong>which wrote the GPL</strong>. Here is what the FSF has to say <a href="https://web.archive.org/web/20100825003651/http://www.gnu.org/licenses/old-licenses/gpl-2.0-faq.html#MereAggregation">in the GPL v2 FAQ</a>. They wrote the license, so you should consider carefully what they have to say when trying to determine the spirit of the GPL:</p> <blockquote><p>If the modules are included in the same executable file, they are definitely combined in one program. <strong>If modules are designed to run linked together in a shared address space, that almost surely means combining them into one program.</strong></p></blockquote> <p>The bolded part is how themes work in WordPress. The fact that themes don&#8217;t come bundled with WordPress is merely a result of WordPress&#8217; flexible plugin/theme architecture and how non-compiled scripting languages like PHP work. The PHP opcode is compiled on the fly, so you can distribute portions of a WP+Plugins+Theme application piece by piece, and they&#8217;ll dynamically combine into one application.</p> <h3>FAQs</h3> <h4>What about making money?</h4> <p>The GPL does not prohibit developers from charging for their code! The overwhelming majority of premium theme developers sell their themes under the GPL (and are making quite a lot of money doing it).</p> <h4>My JS/CSS/Images are 100% original. Do they have to be GPL?</h4> <p>No, they don&#8217;t. If they aren&#8217;t based on GPL&#8217;d JavaScript, CSS, or images, you are not forced to make them GPL. What you could do is offer a theme under a split license. The PHP would be under the GPL, but other static resources could be under some other license.</p> <h4>Won&#8217;t people just take my theme without paying for it?</h4> <p>You don&#8217;t have to offer it as an open download to everyone. You can put it behind a  pay wall. With regards to people getting it from a friend, or a torrent site, etc — this would happen even with a proprietary license. Do a Google search for &#8220;{proprietary theme name} torrent download&#8221; and you&#8217;ll see what I mean. What people are not able to get without paying is your support. This is a huge part of why people pay for premium themes — they have a knowledgable resource to call on if something goes wrong. That&#8217;s something that is irreplaceable, because no one knows the theme better than you do!</p> <h4>What about a developer license?</h4> <p>Theme PHP code must be GPL. You could do a split license on the CSS and JS and other non-GPL static resources. You can license those elements to one site, but let people with a developer license use them on multiple sites. Or, you could have an affiliate program that is only open to people with a developer license. You could seed betas to developers early. You could offer an exclusive developer forum. You could offer enhanced support. There are tons of possible models. The only thing you can&#8217;t do is restrict how people can use the GPL-derivative code.</p> <h4>Does this mean that the custom theme I developed for a client is GPL?</h4> <p>No. The GPL is triggered by distribution. Work-for-hire for a client is not distribution. In this case, they would have the copyright on the code. Distributing it would be up to them. As long as they didn&#8217;t distribute it, the GPL wouldn&#8217;t kick in. Your clients needn&#8217;t worry.</p> <h4>Can my employees take my custom theme and distribute it?</h4> <p>No, allowing access to GPL&#8217;d code by an employee is not distribution, and the company would have the copyright on the code. A company is considered one entity, so transferring the theme within that entity is not distribution.</p> <h4>What about plugins?</h4> <p>Everything in here applies to plugins as well as themes. The only difference between the two is that you generally have one theme active, but might have multiple plugins active. As far as interactions with WordPress go, they work the same way.</p> <h3>Conclusion</h3> <p>Theme code combines with WordPress code in a way that makes them one functional unit. <strong>This is what makes WordPress themes so powerful and flexible.</strong> Themes cannot stand by themselves, and are dependent on deeply integrating their code with WordPress core code in order to function at all. They cannot reasonably be considered original works. As such, theme PHP code (and any CSS/JS code that is derived from GPL&#8217;d code) must be licensed under the GPL if it is distributed.</p> <p>If you refuse to abide by that licensing requirement, you forfeit your right to distribute WordPress extensions (themes or plugins). WordPress is copyrighted. If you do not accept WordPress&#8217; license, you still have to respect our copyright. There are other platforms that do not have this licensing restriction (Drupal, Joomla, Movable Type Open Source, and Textpattern are all GPL, so you&#8217;d have the same issue with them).</p> <h3>Discussion</h3> <p>Please remember that this is about copyright and respecting the license that the WordPress copyright holders have chosen. It isn&#8217;t about money. Premium themes are fine. It is non-GPL themes (a.k.a. proprietary themes) that are the issue. Also realize that WordPress cannot change its license. It is forever locked to the GPL (version 2). Arguments along the lines of &#8220;WordPress should allow proprietary themes because of X,&#8221; are pointless. We are as much bound by the license as theme developers!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 17, 2010 at 12:29 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/themes/" rel="tag">themes</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/gpl/" rel="tag">GPL</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/thesis/" rel="tag">Thesis</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/license-2/" rel="tag">License</a></p></div> </div> </div> <div class="post-451 post type-post hentry category-ask-wordpress category-wordpress"> <h2 id="post-451"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/08/wordpress-question-answer-july-5th-2010/" rel="bookmark">WordPress Q &amp; A: Week of July 5th,&nbsp;2010</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/08/wordpress-question-answer-july-5th-2010/#comments">with 11 comments</a></p> <div class="main"> <div class="snap_preview"><h4>Brad asks:</h4> <blockquote><p>What&#8217;s the optimal way to store large amounts of meta data for a taxonomy without creating a custom table in WordPress?</p></blockquote> <p>WordPress has meta tables for the site (options table), posts, comments and users. It lacks a table for meta data about taxonomies (categories, tags, custom taxonomies). Solutions for this aren&#8217;t going to be simple, but I can think of a solution that doesn&#8217;t create extra tables. You could create a &#8220;shadow&#8221; entry in the posts table for each term, using a custom post type (say, &#8220;taxonomy-meta&#8221;). Then, just attach meta key/value pairs to that post entry.</p> <p>As for linking the post proxy entry to its corresponding term, you could use the taxonomy system to place that term within that taxonomy, but it would probably be much faster to appropriate one of the existing fields, since this is a one-to-one relationship. I&#8217;d probably use <code>post_name</code> and make it something like <code>taxonomy-meta-term-{$term_id}</code>. That way, it&#8217;d be fairly straightforward to grab the proxy object that corresponded to a particular term.</p> <p>I&#8217;d create four API functions. One backend function to get the post ID of the proxy object corresponding to a particular term. A backend function to create a proxy object for a term if it doesn&#8217;t exist. And then one to update taxonomy meta, and one to get taxonomy meta.</p> <p>It sounds complicated, but it shouldn&#8217;t be more than 30-40 lines of code. And your API would be simple. Share the code if you end up doing this!</p> <h4>&#8220;K. K.&#8221; asks:</h4> <blockquote><p>Can you explain how to become a core WordPress developer like you?</p></blockquote> <p>WordPress is a meritocracy, so to get the &#8220;props&#8221; you have to show your worth and put in the time. Start by lurking in <a href="https://web.archive.org/web/20100825003651/http://core.trac.wordpress.org/">Trac</a> and seeing how we develop. Observe the weekly WordPress meetings in <code>#wordpress-dev</code> on Freenode. Then, when you feel confident, start submitting patches to Trac on tickets that need them. Or test the patches that are up there. Follow the tickets and respond to feedback. People who consistently provide quality patches and who seem to &#8220;get&#8221; the WordPress principles (e.g. options are bad, keep core light, target the 80% need, etc) will rise fairly quickly in prominence.</p> <h4>Ted asks:</h4> <blockquote><p>Are there any plans to incorporate Facebook connect or any of the other 3rd-party authentication mechanisms into WordPress? If not, are there any FB connect plugins you&#8217;d recommend &#8212; ideally ones that work for both WP and BuddyPress?</p></blockquote> <p>Facebook Connect — no. We might consider third party mechanisms like OpenID+OAuth, but they&#8217;re not on the short-term roadmap. The most popular Facebook Connect plugin seems to be <del datetime="2010-07-08T09:55:06+00:00"><a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/wp-facebookconnect/">WP-FacebookConnect</a>, written by a Facebook dev</del> <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/simple-facebook-connect/">Simple Facebook Connect</a>.</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 8, 2010 at 3:24 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/ask-wordpress/" title="View all posts in Ask WordPress" rel="category tag">Ask WordPress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> </div> </div> </div> <div class="post-446 post type-post hentry category-wordpress tag-development tag-questions"> <h2 id="post-446"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/07/01/ask-a-wordpress-dev/" rel="bookmark">Ask a WordPress&nbsp;Dev!</a></h2> <div class="main"> <div class="snap_preview"><p>I&#8217;ve set up a <a href="/web/20100825003651/http://markjaquith.wordpress.com/ask-wordpress/">question submission form</a> where you can send me interesting WordPress-related questions. They can be seeking advice on everything from usage, to hardcore plugin and theme development issues. I&#8217;ll periodically pick a good one and answer it here on this blog!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>July 1, 2010 at 2:41 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/development/" rel="tag">development</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/questions/" rel="tag">questions</a></p></div> </div> </div> <div class="post-431 post type-post hentry category-wordpress tag-security tag-hosting tag-web-hosts tag-performance"> <h2 id="post-431"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/05/14/web-hosts-should-adapt-to-wordpress/" rel="bookmark">Web Hosts: WordPress is here to stay.&nbsp;Adapt!</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/05/14/web-hosts-should-adapt-to-wordpress/#comments">with 102 comments</a></p> <div class="main"> <div class="snap_preview"><p><a href="https://web.archive.org/web/20100825003651/http://wordpress.org/">WordPress</a> is the number one user-installed web app, and its growth is showing no signs of slowing. If you are a web host, and you don&#8217;t have a specific strategy for WordPress, you&#8217;re likely operating your service inefficiently, and may be opening yourself up to security issues. This is the year to adapt, or be left behind by nimbler upstarts.</p> <h3>Performance</h3> <p>WordPress does not currently ship with any output caching. First, because most blogs never get enough traffic to need it, so it&#8217;s not worth the added complexity and configuration that it would add to our relatively nimble core. But also because every environment is different, and what works on one web host may actually degrade performance on another. So we leave it up to the WordPress user to choose whether they need a caching plugin, and which one to run.</p> <p>As a web host, you know what caching strategies will work best with your server architecture. You have the ability to roll out things like Memcached or APC. You can route image requests to a lightweight web server or a CDN. These changes will result in a better user experience, and they&#8217;ll save you money.</p> <h3>Security</h3> <p>All code has bugs. WordPress has had its share of security issues through the years. As a web host, you can help keep your users out in front of security issues instead of just being reactive when someone gets hacked. First, by encouraging, or even demanding that users upgrade their sites to the newest available version of WordPress. In practice, there aren&#8217;t any widespread attacks against the current version of WordPress. The large scale attacks you see from time to time are against old versions of the software whose users haven&#8217;t updated in a while. It is in a web host&#8217;s interest to encourage upgrades and reduce the incidence of exploitation.</p> <p>Because WordPress is so widespread, it also is often the victim of attacks that originated against other software or server misconfiguration. So a bad guy gets in using something else, and then once in, they look for WordPress installs to exploit. You can help users recover from these attacks by aggressively backing up their data and by looking for suspicious files or suspicious code that could indicate that a bad actor is exploiting their WordPress install.</p> <h3>What you can do</h3> <ul> <li>Get your company to abandon the mindset that you&#8217;re just a dumb host who doesn&#8217;t care what software your users are running. Users want and are willing to pay for a more specialized experience. If you tell them that it&#8217;s not your problem, they&#8217;re going to go find a service that will support their web hosting needs.</li> <li>Offer WordPress-specific hosting. Specially optimized, prodigiously backed up, with a more locked-down environment. And because it is a specialty service, you can charge more than you do for your regular hosting products!</li> <li>Build an internal WordPress Response Team that has in-depth training to help diagnose and fix WordPress bug, security and scaling issues. And in the meantime, hire a <a title="WordPress consulting" href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/">WordPress consultant like me</a> or one of <a href="https://web.archive.org/web/20100825003651/http://codepoet.com/">these fine consultancies</a> to get your WordPress strategy rolling.</li> </ul> <p>People ask me for hosting recommendations all the time. I have a few decent hosts that I&#8217;ll recommend, but I don&#8217;t have any hosts about which I can say &#8220;use them, because they know how to host WordPress, and they&#8217;ll support you.&#8221; I&#8217;d like nothing better than to have a dozen such hosts to recommend by this time next year. WordPress is here to stay, and it&#8217;s time for web hosts to adapt!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>May 14, 2010 at 4:17 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/security/" rel="tag">security</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/hosting/" rel="tag">Hosting</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/web-hosts/" rel="tag">web hosts</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/performance/" rel="tag">performance</a></p></div> </div> </div> <div class="post-418 post type-post hentry category-wordpress tag-plugin-directory tag-satire tag-wordpress"> <h2 id="post-418"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/02/11/how-to-get-plugin-removed-from-dir/" rel="bookmark">How to get your plugin removed from the&nbsp;directory</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/02/11/how-to-get-plugin-removed-from-dir/#comments">with 79 comments</a></p> <div class="main"> <div class="snap_preview"><p>The following is a non-exhaustive list of things you can do to get your plugin rejected or removed from the WordPress.org plugin directory.</p> <p>Yes, this is tongue-in-cheek.<strong> This is a list of things NOT TO DO.</strong></p> <ol> <li>Give it a license that is incompatible with WordPress&#8217; license.</li> <li>Host your plugin elsewhere, and only use the WordPress.org plugin listing as a pointer to that.</li> <li>Use base64 encoding to hide your plugin code or obfuscate HTML that you&#8217;re injecting into people&#8217;s blogs.</li> <li>Insert SEO spam links into people&#8217;s blogs (like &lt;a href=&#8221;http://example.com/&#8221;&gt;video poker&lt;/a&gt;).</li> <li>Insert external links (like a credit link, &lt;a href=&#8221;http://example.com/&#8221;&gt;My Awesome Plugin by Awesome Sauce&lt;/a&gt;) into their blog without explicitly asking their permission, or make the default option be to insert the link.</li> <li>Load portions of the code from an external site for no valid reason, or use any other trick to work around #3, #4 and #5.</li> <li>Harvest people&#8217;s e-mail addresses or require registration to activate the plugin.</li> <li>Explicitly state or imply that users of the plugin must pay you money in order to use the plugin.</li> <li>Make the plugin a &#8220;requirements check&#8221; or bootstrapper for some other plugin, hosted elsewhere. See #2.</li> <li>Make it do something illegal.</li> <li>Make it do something sneaky, underhanded, or otherwise dishonest or immoral. Maybe a plugin that disables all plugins by a plugin author you don&#8217;t particularly like. Harvest the user&#8217;s password. Use your imagination!</li> </ol> <p>Again, this is a list of things <strong>not</strong> to do. <strong>It is not comprehensive.</strong> Be cool, think of how your plugin benefits its users, and write awesome plugins.</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>February 11, 2010 at 7:22 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/plugin-directory/" rel="tag">plugin directory</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/satire/" rel="tag">satire</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a></p></div> </div> </div> <div class="post-410 post type-post hentry category-wordpress tag-directory tag-i-make-plugins tag-plugin tag-repository tag-wordpress"> <h2 id="post-410"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/01/18/new-plugin-i-make-plugins/" rel="bookmark">New Plugin &#8211; &#8220;I Make&nbsp;Plugins&#8221;</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2010/01/18/new-plugin-i-make-plugins/#comments">with 33 comments</a></p> <div class="main"> <div class="snap_preview"><p>I have several WordPress plugins. They&#8217;re hosted on the <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/">WordPress.org plugin repository</a>, but I also have a page for each plugin <a href="https://web.archive.org/web/20100825003651/http://txfx.net/wordpress-plugins/">on my own site</a>. I&#8217;ve found it tedious to have to update both places separately. Things get out of sync, or worse, I put off plugin updates because I loathe updating two places (with two different formats) with the same information.</p> <p>The WordPress plugin repository has an API. Let&#8217;s use it! <a href="https://web.archive.org/web/20100825003651/http://txfx.net/wordpress-plugins/i-make-plugins/">I Make Plugins</a> is a plugin for WordPress plugin authors to let them easily showcase their plugins on their own site, solely by updating the plugin&#8217;s <code>readme.txt</code> file.</p> <p>Adding a plugin is as simple as creating a new subpage of your plugin listing page, and giving it the name of your plugin in the repository. All the information comes from the API and is kept up to date.</p> <p>Here is a nine and a half minute. boring-as-hell screencast with a full tour of the plugin.</p> <div id="x-video-2" class="video-player"> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="700" height="842" id="video2" standby="\&quot;I Make Plugins\&quot; - a plugin for plugin developers"> <param name="movie" value="http://s0.videopress.com/player.swf?v=1.02"/> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=2p6Q4wto&amp;javascriptid=video2"/> <!--[if !IE]>--> <object type="application/x-shockwave-flash" data="https://web.archive.org/web/20100825003651im_/http://s0.videopress.com/player.swf?v=1.02" width="700" height="842" standby="\&quot;I Make Plugins\&quot; - a plugin for plugin developers"> <param name="wmode" value="transparent"/><param name="seamlesstabbing" value="true"/><param name="allowfullscreen" value="true"/><param name="allowscriptaccess" value="always"/><param name="overstretch" value="true"/> <param name="flashvars" value="guid=2p6Q4wto&amp;javascriptid=video2"/> <!--<![endif]--> <img alt="\&quot;I Make Plugins\&quot; - a plugin for plugin developers" src="https://web.archive.org/web/20100825003651im_/http://videos.videopress.com/2p6Q4wto/i-make-plugins_std.original.jpg" width="700" height="842"/><p><strong>\&quot;I Make Plugins\&quot; - a plugin for plugin developers</strong></p><p class="robots-nocontent">This movie requires <a rel="nofollow" href="https://web.archive.org/web/20100825003651/http://www.adobe.com/go/getflashplayer">Adobe Flash</a> for playback.</p> <!--[if !IE]>--> </object> <!--<![endif]--> </object> </div> <p>I realize that writing a plugin for plugin developers is probably a futile gesture. Plugin developers are choosy people, and many may already have their own setup for managing their stable of plugins. I wrote this for myself — but let me know if you find it useful!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>January 18, 2010 at 7:32 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/directory/" rel="tag">directory</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/i-make-plugins/" rel="tag">I make plugins</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/plugin/" rel="tag">plugin</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/repository/" rel="tag">repository</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a></p></div> </div> </div> <div class="post-389 post type-post hentry category-wordpress tag-wordpress tag-wordpress-2-9 tag-post-thumbnails tag-post-images"> <h2 id="post-389"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/" rel="bookmark">New in WordPress 2.9: Post Thumbnail&nbsp;Images</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/23/new-in-wordpress-2-9-post-thumbnail-images/#comments">with 448 comments</a></p> <div class="main"> <div class="snap_preview"><p>Many WordPress themes, especially those with &#8220;magazine-like&#8221; layouts, use an image to represent each post. It might just be on the front page. It might be alone, or alongside an excerpt. Until now, there was no standardized way to do this. Many themes would require you to tediously enter a Custom Field with the value being the URL you wanted to use. Often you had to do cropping yourself. With WordPress 2.9, theme authors can easily enable Post Thumbnail selection UI and call those image using simple template tags.</p> <p><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2009/12/post-thumbnail.png?w=297&amp;h=138" alt="" title="post-thumbnail" width="297" height="138" class="aligncenter size-full wp-image-392"/></p> <p>First, in the theme&#8217;s <code>functions.php</code>, declare that your theme supports this feature. This will enable the UI in the WP Admin.</p> <pre class="brush: php;">add_theme_support( 'post-thumbnails' );</pre> <p>That will enable Post Thumbnail UI for both Post and Page content types. If you&#8217;d only like to add it to one, you can do it like this:</p> <pre class="brush: php;">add_theme_support( 'post-thumbnails', array( 'post' ) ); // Add it for posts add_theme_support( 'post-thumbnails', array( 'page' ) ); // Add it for pages</pre> <p>Simply remove the one you don&#8217;t want to support.</p> <p>Next, you should specify the dimensions of your post thumbnails. You have two options here: box-resizing and hard-cropping. Box resizing shrinks an image proportionally (that is, without distorting it), until it fits inside the &#8220;box&#8221; you&#8217;ve specified with your width and height parameters. For example, a 100&#215;50 image in a 50&#215;50 box would be resized to 50&#215;25. The benefit here is that the entire image shows. The downside is that the image produced isn&#8217;t always the same size. Sometimes it will be width-limited, and sometimes it will be height-limited. If you&#8217;d like to limit images to a certain width, but don&#8217;t care how tall they are, you can specify your width and then specify a height of 9999 or something ridiculously large that will never be hit.</p> <pre class="brush: php;">set_post_thumbnail_size( 50, 50 ); // 50 pixels wide by 50 pixels tall, box resize mode</pre> <p>Your second option is hard-cropping. In this mode, the image is cropped to match the target aspect ratio, and is then shrunk to fit in the specified dimensions <strong>exactly</strong>. The benefit is that you get what you ask for. If you ask for a 50&#215;50 thumbnail, you get a 50&#215;50 thumbnail. The downside is that your image will be cropped (either from the sides, or from the top and bottom) to fit the target aspect ratio, and that part of the image won&#8217;t show up in the thumbnail.</p> <pre class="brush: php;">set_post_thumbnail_size( 50, 50, true ); // 50 pixels wide by 50 pixels tall, hard crop mode</pre> <p>Now, you can make use of the template functions to display these images in the theme. These functions should be used in the loop.</p> <p><code>has_post_thumbnail()</code> returns true/false and indicates whether the current post has a manually-chosen Post Thumbnail (in the loop):</p> <pre class="brush: php;">&lt;?php if ( has_post_thumbnail() ) { // the current post has a thumbnail } else { // the current post lacks a thumbnail } ?&gt;</pre> <p><code>the_post_thumbnail()</code> outputs the Post Thumbnail, if it exists (in the loop):</p> <pre class="brush: php;">&lt;?php the_post_thumbnail(); ?&gt;</pre> <p>Those are the basics. How about some advanced stuff?</p> <p>What if you want to use a small 50&#215;50 hard-cropped image for the home page, but want to use a 400 pixel-wide (unlimited height) image on the post&#8217;s permalink page? You&#8217;re in luck. You can specify additional custom sizes! Here&#8217;s the code:</p> <p><code>functions.php</code></p> <pre class="brush: php;">add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size</pre> <p><code>home.php</code> or <code>index.php</code>, depending on your theme structure (in the loop):</p> <pre class="brush: php;">&lt;?php the_post_thumbnail(); ?&gt;</pre> <p><code>single.php</code> (in the loop):</p> <pre class="brush: php;">&lt;?php the_post_thumbnail( 'single-post-thumbnail' ); ?&gt;</pre> <p>That&#8217;s it! <code>set_post_thumbnail_size()</code> just calls <code>add_image_size( 'post-thumbnail' )</code> &#8212; the default Post Thumbnail &#8220;handle.&#8221; But as you can see, you can add additional ones by calling <code>add_image_size( $handle, $width, $height, {$hard_crop_switch} );</code>, and then you use that new size by passing the handle to <code>the_post_thumbnail( $handle );</code></p> <p>If you want your theme to support earlier versions of WordPress, you&#8217;ll have to use <code>function_exists()</code> to keep from calling these new functions in those versions. I&#8217;ve omitted that code to keep these examples as simple as possible. Here would be the <code>functions.php</code> example with the wrapper code:</p> <pre class="brush: php;">if ( function_exists( 'add_theme_support' ) ) { // Added in 2.9 add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 50, 50, true ); // Normal post thumbnails add_image_size( 'single-post-thumbnail', 400, 9999 ); // Permalink thumbnail size }</pre> <p>There is one caveat for this feature in WordPress 2.9 &#8212; it only works <strong>fully</strong> for new image uploads. We can&#8217;t yet resize images on the fly, although I&#8217;m strongly considering it for a future version. If you call the template functions on a post that has a Post Thumbnail that was uploaded prior to your theme having declared the new sizes, you won&#8217;t be able to do hard-cropping, and the box-resize will be done in the browser. As a temporary solution, Viper007Bond has a great plugin that will go back and create missing image sizes for you: <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/extend/plugins/regenerate-thumbnails/">Regenerate Thumbnails</a>.</p> <p>I&#8217;m looking forward to see what kinds of sites you can build with this feature!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>December 23, 2009 at 3:19 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress-2-9/" rel="tag">WordPress 2.9</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/post-thumbnails/" rel="tag">Post Thumbnails</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/post-images/" rel="tag">Post Images</a></p></div> </div> </div> <div class="post-384 post type-post hentry category-wordpress tag-poll tag-wordpress"> <h2 id="post-384"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/15/how-should-your-post-has-been-saved-view-post-links-open/" rel="bookmark">How should &#8220;Post updated. View Post&#8221; links&nbsp;open?</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/15/how-should-your-post-has-been-saved-view-post-links-open/#comments">with 84 comments</a></p> <div class="main"> <div class="snap_preview"><p>We&#8217;ve gone back and forth on this. How should the &#8220;View Post&#8221; link that shows up next to the &#8220;Post updated&#8221; (or similar) text work? Should it open in the same window/tab, or should it open in a new window/tab?</p> <p><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2009/12/post-updated.png?w=634&amp;h=94" alt="" title="post-updated" width="634" height="94" class="aligncenter size-full wp-image-387"/></p> <p>The problem with this question is that the people who have really strong opinions in favor of opening the tab in the same window are all power users. They&#8217;re people like me. I don&#8217;t think I can give an objective answer on this, because manually opening a window in a new tab is a skill that I don&#8217;t even think about, I use it so much. I realize that&#8217;s probably not the case for many WordPress users.</p> <p>We&#8217;re going to use the honor system on this, so be honest:</p> <p><strong>Do not vote in this poll if your mouse has more features than two buttons and a scroll wheel, and you know how to use them. Do not vote in this poll if you know what &#8220;middle-clicking&#8221; is.</strong></p> <a name="pd_a_2388943"></a><div class="PDS_Poll" id="PDI_container2388943" style="display:inline-block;"></div><script type="text/javascript" language="javascript" charset="utf-8" src="https://web.archive.org/web/20100825003651js_/http://static.polldaddy.com/p/2388943.js"></script> <noscript> <a href="https://web.archive.org/web/20100825003651/http://answers.polldaddy.com/poll/2388943/">View This Poll</a><br/><span style="font-size:10px;"><a href="https://web.archive.org/web/20100825003651/http://polldaddy.com/features-surveys/">survey software</a></span> </noscript> <p>I&#8217;m abstaining from voting, as my mouse has 7 buttons, one 4-way scroll wheel, and another two-way thumb wheel. <img src="https://web.archive.org/web/20100825003651im_/http://s.wordpress.com/wp-includes/images/smilies/icon_smile.gif" alt=":-)" class="wp-smiley"/> </p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>December 15, 2009 at 8:16 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/poll/" rel="tag">poll</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a></p></div> </div> </div> <div class="post-377 post type-post hentry category-wordpress tag-code tag-hidden-plugins tag-hidden-themes tag-plugins tag-themes tag-wordpress"> <h2 id="post-377"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/" rel="bookmark">Excluding your plugin or theme from update&nbsp;checks</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/12/14/excluding-your-plugin-or-theme-from-update-checks/#comments">with 30 comments</a></p> <div class="main"> <div class="snap_preview"><p>There has been a vigorous discussion going on regarding what data WordPress installs send to WordPress.org when doing update checks. Because WordPress (the software) doesn&#8217;t know whether a theme or plugin is listed in the WordPress.org repositories, it has to check them all, and let the repository sort it out. Some have expressed concern that private plugins developed for a single client could contain sensitive information in their headers, like contact information for the developer, etc.</p> <p>If you, as a plugin or theme developer, would like to exclude one of your plugins or themes from the update array, the following code will do the trick.</p> <p>For plugins:</p> <pre class="brush: php;">function cws_hidden_plugin_12345( $r, $url ) { if ( 0 !== strpos( $url, 'http://api.wordpress.org/plugins/update-check' ) ) return $r; // Not a plugin update request. Bail immediately. $plugins = unserialize( $r['body']['plugins'] ); unset( $plugins-&gt;plugins[ plugin_basename( __FILE__ ) ] ); unset( $plugins-&gt;active[ array_search( plugin_basename( __FILE__ ), $plugins-&gt;active ) ] ); $r['body']['plugins'] = serialize( $plugins ); return $r; } add_filter( 'http_request_args', 'cws_hidden_plugin_12345', 5, 2 );</pre> <p>Just change the <code>cws_hidden_plugin_12345</code> string (two instances) to a namespaced function name for your plugin, and you&#8217;re good to go.</p> <p>For themes:</p> <pre class="brush: php;">function cws_hidden_theme_12345( $r, $url ) { if ( 0 !== strpos( $url, 'http://api.wordpress.org/themes/update-check' ) ) return $r; // Not a theme update request. Bail immediately. $themes = unserialize( $r['body']['themes'] ); unset( $themes[ get_option( 'template' ) ] ); unset( $themes[ get_option( 'stylesheet' ) ] ); $r['body']['themes'] = serialize( $themes ); return $r; } add_filter( 'http_request_args', 'cws_hidden_theme_12345', 5, 2 );</pre> <p>Put this in your theme&#8217;s functions.php Again, just change the <code>cws_hidden_theme_12345</code> string (two instances) to a namespaced function name for your theme. Do note that this will only hide the ACTIVE theme. This code doesn&#8217;t get run if the theme isn&#8217;t active. If you want to hide non-active themes, you&#8217;ll have to put this code in a plugin and instead of using <code>get_option( 'template' )</code> or <code>get_option( 'stylesheet' )</code> you&#8217;d hardcode the values for the inactive theme you want to hide.</p> <p>Just a note: I don&#8217;t want the comments to turn into another battlefield for the update check debate. I&#8217;m putting my code where my mouth is and showing you how you can keep private plugins/themes from contacting WordPress.org if you so wish. Comments about this code are welcomed!</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>December 14, 2009 at 7:14 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/code/" rel="tag">code</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/hidden-plugins/" rel="tag">hidden plugins</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/hidden-themes/" rel="tag">hidden themes</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/plugins/" rel="tag">plugins</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/themes/" rel="tag">themes</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a></p></div> </div> </div> <div class="post-369 post type-post hentry category-wordpress tag-coding tag-commenting tag-css tag-php tag-tip tag-trick"> <h2 id="post-369"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/11/21/block-level-comments-trick/" rel="bookmark">Block-level comments&nbsp;trick</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/11/21/block-level-comments-trick/#comments">with 32 comments</a></p> <div class="main"> <div class="snap_preview"><p>Block-level comments are useful for commenting out an entire block of code in PHP, CSS, and other code contexts.</p> <pre class="brush: php;"> /* $this = 'code is deactivated'; $and = 'so is this'; */ </pre> <p>The only problem with this is that when you go to re-activate this code, you have to change both the opening and closing comment markers. That&#8217;s a pain.</p> <p>While I was at WordCamp NYC last week, I saw <a href="https://web.archive.org/web/20100825003651/http://wpmama.com/">Daisy Olsen</a> using a very clever trick in her lightning round talk.</p> <pre class="brush: php;"> /* $this = 'code is deactivated'; $and = 'so is this'; /**/ </pre> <p>See what she did there? The closing comment marker is preceded by another opening marker. Because comment blocks can&#8217;t be nested, this second opening comment marker is ignored. This enabled her to re-enable this code by removing the opening marker.</p> <pre class="brush: php;"> $this = 'code is reactivated'; $and = 'so is this'; /**/ </pre> <p>Brilliant! I can&#8217;t believe I haven&#8217;t seen this before. The one downside to this is that you are deleting two characters and destroying the opening marker. Here&#8217;s an even better method.</p> <pre class="brush: php;"> //* $this = 'code is reactivated'; $and = 'so is this'; /**/ </pre> <p>By adding a slash in front of the opening comment marker, I comment out the comment marker. It only takes one key press, and the corpse of the original opening marker is retained, allowing you to reinstate it with the deletion of a single character.</p> <p>Props to <a href="https://web.archive.org/web/20100825003651/http://aleembawany.com/2009/01/27/lazy-block-comment-trick/">Aleem Bawany</a> for the second trick (he uses <code>//*/</code> as the closing comment, which works pretty much the same way).</p> <p>What other commenting tricks do you know?</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>November 21, 2009 at 12:49 am</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/coding/" rel="tag">coding</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/commenting/" rel="tag">commenting</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/css/" rel="tag">CSS</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/php/" rel="tag">php</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/tip/" rel="tag">tip</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/trick/" rel="tag">trick</a></p></div> </div> </div> <div class="post-359 post type-post hentry category-wordpress tag-wordpress tag-php tag-tip tag-widgets tag-php5 tag-php4 tag-constructor tag-construct"> <h2 id="post-359"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/09/29/using-php5-object-constructors-in-wp-widget-api/" rel="bookmark">Using PHP5 object constructors in WP Widget&nbsp;API</a></h2> <p class="comments"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/2009/09/29/using-php5-object-constructors-in-wp-widget-api/#comments">with 10 comments</a></p> <div class="main"> <div class="snap_preview"><p>Someone mentioned to me that they couldn&#8217;t use PHP5-style object constructors when using the WP Widget API. I looked into it, and it turns out it does work. Example:</p> <pre class="brush: php;"> class My_Widget extends WP_Widget { function __construct() { $widget_ops = array( 'classname' =&gt; 'css-class', 'description' =&gt; 'Description' ); parent::__construct( 'css-class', 'Title', $widget_ops ); } // Rest of your widget subclass goes here } </pre> <p>The key is using <code>parent::__construct()</code> instead of <code>$this-&gt;WP_Widget()</code>.</p> </div></div> <div class="meta group"> <div class="signature"> <p>Written by Mark Jaquith <span class="edit"></span></p> <p>September 29, 2009 at 1:15 pm</p> </div> <div class="tags"> <p>Posted in <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" title="View all posts in wordpress" rel="category tag">wordpress</a></p> <p>Tagged with <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/wordpress/" rel="tag">wordpress</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/php/" rel="tag">php</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/tip/" rel="tag">tip</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/widgets/" rel="tag">Widgets</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/php5/" rel="tag">PHP5</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/php4/" rel="tag">PHP4</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/constructor/" rel="tag">constructor</a>, <a href="https://web.archive.org/web/20100825003651/http://en.wordpress.com/tag/__construct/" rel="tag">__construct()</a></p></div> </div> </div> <div class="navigation group"> <div class="alignleft"><a href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/page/2/">&laquo; Older Entries</a></div> <div class="alignright"></div> </div> </div> <div id="sidebar"> <form role="search" method="get" id="searchform" action="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/"> <div><label class="screen-reader-text" for="s">Search for:</label> <input type="text" value="" name="s" id="s"/> <input type="submit" id="searchsubmit" value="Search"/> </div> </form><h3>About</h3> <div class="textwidget"><p>Hi, I'm <a href="https://web.archive.org/web/20100825003651/http://markjaquith.com/">Mark Jaquith</a>, a provider of <a href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/">freelance WordPress services</a>, and a <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/about/">lead developer</a> of the <a href="https://web.archive.org/web/20100825003651/http://wordpress.org/">WordPress personal publishing platform</a>.</p> <p><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2009/09/headshot-5-thin-wpcom.jpg" alt="headshot of Mark Jaquith"/></p> <p>This is my blog for all things WordPress. Go to my digital hub at <a href="https://web.archive.org/web/20100825003651/http://markjaquith.com/">markjaquith.com</a> for links to my other online presences.</p> <p><a href="https://web.archive.org/web/20100825003651/http://twitter.com/markjaquith"><img src="https://web.archive.org/web/20100825003651im_/http://markjaquith.files.wordpress.com/2010/04/twitter.gif" alt="Follow me on Twitter!" title="Click here to view my Twitter stream and to follow me on Twitter"/></a></p> <div id="mjcombar"> <ul> <li><a class="first" href="https://web.archive.org/web/20100825003651/http://markjaquith.com/">Mark Jaquith</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://txfx.net/">Tempus Fugit</a></li> <li><a class="current-site" href="https://web.archive.org/web/20100825003651/http://markjaquith.wordpress.com/">Mark on WordPress</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://flickr.com/photos/markjaquith">Flickr Photostream</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://coveredwebservices.com/">WordPress Consulting</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://twitter.com/markjaquith">Twitter</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://friendfeed.com/markjaquith">FriendFeed</a></li> <li><a href="https://web.archive.org/web/20100825003651/http://wordsplosion.com/">Wordsplosion!</a></li> </ul> </div> </div> <h3>Ask a WordPress Dev</h3> <div class="textwidget"><p>Do you have an interesting WordPress-related question? <a href="/web/20100825003651/http://markjaquith.wordpress.com/ask-wordpress/">Submit your questions</a>, and I'll periodically pick the best one and answer it here on my blog! It can be anything from usage tips to hardcore WP development questions.</p> </div> <h3><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/feed/" title="Syndicate this content"><img style="background:orange;color:white;border:none;" width="14" height="14" src="https://web.archive.org/web/20100825003651im_/http://s.wordpress.com/wp-includes/images/rss.png" alt="RSS"/></a> <a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/" title="Mark Jaquith's blog about capitalism, freedom, WordPress, the web, and personal topics">Tempus Fugit | Mark&#8217;s personal blog</a></h3><ul><li><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/2010/08/08/judge-andrew-napolitano-on-wikileaks/" title="Judge Andrew Napolitano on WikiLeaks and exposing government lies.">Judge Andrew Napolitano on WikiLeaks</a></li><li><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/2010/07/01/area-man-passionate-defender-of-what-he-imagines-constitution-to-be-the-onion-americas-finest-news-source/" title="Ha! Great Right/Left skewering by The Onion. “Dad’s great, but listening to all that talk radio has put some weird ideas into his head,” said daughter Samantha, a freshman at Reed College in Portland, OR. “He believes the Constitution allows the government to torture people and ban gay marriage, yet he doesn’t even know that [.. […]">Area Man Passionate Defender Of What He Imagines Constitution To Be | The Onion – America’s Finest News Source</a></li><li><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/2010/06/30/sonia-sotomayor-and-the-second-amendment/" title="Big surprise. The position Sonia Sotomayor espoused in her Senate confirmation hearing doesn’t jibe with the dissent she joined in McDonald v. Chicago. I understand the individual right fully that the Supreme Court recognized in Heller. vs In sum, the Framers did not write the Second Amendment in order to protect a private right of [...]">Sonia Sotomayor and the Second Amendment</a></li><li><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/2010/06/28/grotesquely-lucky/" title="We are going to die, and that makes us the lucky ones. Most people are never going to die, because they’re never going to be born. The number of people who could be here in my place outnumber the sand grains of the Sahara. If you think about all the different ways in which our [...]">Grotesquely Lucky</a></li><li><a class="rsswidget" href="https://web.archive.org/web/20100825003651/http://txfx.net/2010/06/21/atticus-first-months/" title="By popular request, some more photos of Atticus, ranging from 8 weeks old back to his birth day.">Atticus — first months</a></li></ul> </div> </div> <div id="footer"> <p><a href="https://web.archive.org/web/20100825003651/http://wordpress.com/" rel="generator">Blog at WordPress.com</a>. Theme: Journalist by <a href="https://web.archive.org/web/20100825003651/http://lucianmarin.com/" rel="designer">Lucian E. Marin</a>.</p> </div> <script type="text/javascript">_qoptions={qacct:'p-18-mFEk4J448M',labels:'language.en'};</script> <script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://edge.quantserve.com/quant.js"></script> <noscript><p><img class="robots-nocontent" src="https://web.archive.org/web/20100825003651im_/http://pixel.quantserve.com/pixel/p-18-mFEk4J448M.gif?labels=language.en" style="display:none" height="1" width="1" alt=""/></p></noscript> <script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://b.scorecardresearch.com/beacon.js"></script><script type="text/javascript">try{COMSCORE.beacon({c1:2,c2:7518284});}catch(e){}</script><noscript><p class="robots-nocontent"><img src="https://web.archive.org/web/20100825003651im_/http://b.scorecardresearch.com/p?cj=1c1=2&amp;c2=7518284" alt="" style="display:none" width="1" height="1"/></p></noscript><script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://s0.wp.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter/scripts/shCore.js?m=1258143671g&amp;ver=2.1.364b"></script> <script type="text/javascript" src="https://web.archive.org/web/20100825003651js_/http://s2.wp.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter/scripts/shBrushPhp.js?m=1260182860g&amp;ver=2.1.364b"></script> <script type="text/javascript"> (function(){ var corecss = document.createElement('link'); var themecss = document.createElement('link'); var themecssurl = "https://web.archive.org/web/20100825003651/http://s0.wp.com/wp-content/plugins/syntaxhighlighter-wpcom/shThemeDefault.css?m=1267535107g&amp;ver=2.1.364b"; if ( themecss.setAttribute ) { themecss.setAttribute( "rel", "stylesheet" ); themecss.setAttribute( "type", "text/css" ); themecss.setAttribute( "href", themecssurl ); } else { themecss.rel = "stylesheet"; themecss.href = themecssurl; } document.getElementsByTagName("head")[0].appendChild(themecss); })(); SyntaxHighlighter.config.clipboardSwf = 'https://web.archive.org/web/20100825003651/http://s1.wp.com/wp-content/plugins/syntaxhighlighter/syntaxhighlighter/scripts/clipboard.swf?m=1253219630g'; SyntaxHighlighter.config.strings.expandSource = 'show source'; SyntaxHighlighter.config.strings.viewSource = 'view source'; SyntaxHighlighter.config.strings.copyToClipboard = 'copy to clipboard'; SyntaxHighlighter.config.strings.copyToClipboardConfirmation = 'The code is in your clipboard now'; SyntaxHighlighter.config.strings.print = 'print'; SyntaxHighlighter.config.strings.help = '?'; SyntaxHighlighter.config.strings.alert = 'SyntaxHighlighter\n\n'; SyntaxHighlighter.config.strings.noBrush = 'Can\'t find brush for: '; SyntaxHighlighter.config.strings.brushNotHtmlScript = 'Brush wasn\'t configured for html-script option: '; SyntaxHighlighter.all(); </script> <script src="https://web.archive.org/web/20100825003651js_/http://s.stats.wordpress.com/w.js?19" type="text/javascript"></script> <script type="text/javascript"> st_go({'blog':'316','v':'wpcom','user_id':'0','post':'0','subd':'markjaquith'}); ex_go({'crypt':'RDZ8LFkxbXFRTGFhczN0dGdYUWVsY2lUXURHXWo3VmxCLXlPc3ElUzdOenR5SUJIWTFScj1YUXdaaGImMVVQdXFESWxCaFhzUFlHU0ksZGlnfFF3UUg1QkZZYl0wcCw5LHU2VjJiZHJ3aS1ZJiZBNDNySzNIcmI/LV9faXNjekFDWHl8RlRkPXN+S1AmQ0kmV3piZ0RWUlBZZi1Qd209ajFhWWpPdmo9UDFXfHpvOFd1S09UMUF+XUpLSUIuZiVwbWFuZktSV2cz'}); addLoadEvent(function(){linktracker_init('316',0);}); </script> </body> </html><!-- FILE ARCHIVED ON 00:36:51 Aug 25, 2010 AND RETRIEVED FROM THE INTERNET ARCHIVE ON 04:00:29 Dec 04, 2024. JAVASCRIPT APPENDED BY WAYBACK MACHINE, COPYRIGHT INTERNET ARCHIVE. ALL OTHER CONTENT MAY ALSO BE PROTECTED BY COPYRIGHT (17 U.S.C. SECTION 108(a)(3)). --> <!-- playback timings (ms): captures_list: 2.453 exclusion.robots: 0.033 exclusion.robots.policy: 0.021 esindex: 0.011 cdx.remote: 15.603 LoadShardBlock: 201.014 (3) PetaboxLoader3.datanode: 223.41 (4) PetaboxLoader3.resolve: 212.27 (2) load_resource: 246.843 -->

Pages: 1 2 3 4 5 6 7 8 9 10