Monthly Archives: February 2010

Sample image retrieval code

Built-in function: CODEX: get_the_post_thumbnail

See the ‘rewire’ theme functions.php dp_attachment_image function. Modified to add ‘beforeimg’, ‘afterimg’, and ‘numberposts’ args.

<?php # Displays post image attachment (sizes: thumbnail, medium, full)
function dp_attachment_image($postid=0, $size='thumbnail', $attributes='',$echo=1,
         $beforeimg='',$afterimg='',$numberposts=1) {
   if ($postid<1) $postid = get_the_ID();
   if ($images = get_children(array(
      'post_parent' => $postid,
      'post_type' => 'attachment',
      'numberposts' => $numberposts,
      'post_mime_type' => 'image',)))
      foreach($images as $image) {
         $img = $beforeimg;
         $attachment=wp_get_attachment_image_src($image->ID, $size);
         $img .= "<img src="" $attributes />";
         $img .= $afterimg;
         if ($echo) {
           echo $img;
         } else {
           return $img;

CMS Post Control Plugin

A plugin to control the Edit/Add post page

Different sidebar per post.

How to have a different sidebar for each (or selected) posts.

Related: Changing sidebar layouts

Related: 10 Plugins to enhance your sidebar

Adding Tabs to your theme

Adding MooTabs to your theme.

Add tabs to your theme in the pages or sidebar. Requires MooTools.

Related: Plugin SidebarTabs

Query Multiple Taxonomies Plugin

Query Multiple Taxonomies Plugin

WordPress hooks

Codex Plugin API

Codex Action Hooks

Codex Filter Hooks

Adam Brown’s WordPress Hooks Database

WP Optimization: .htaccess efficiency

WordPress Optimization: .htaccess efficiency

Codex WordPress Optimization

Codex WordPress Optimization

Analyze php code and queries

Codex: Template Tags/query posts

Codex: Template Tags/query posts Query_posts parameters.

Codex: Stepping Into Templates