Monthly Archives: August 2012

Contact Form On A Two Column Page

A couple of threads on the WP Support Forum have asked for help in creating a contact form in one half of a two-column page.

One way to do this is by combining the use of the Fast Secure Contact Form plugin with the WP Easy Columns plugin.  Here is a screenshot of a test page showing the result in the Twenty Ten theme:

Two column contact form

Get Tags For Posts In Selected Categories

The code below will return all Terms that are in the taxonomy ‘post_tags’ and are associated with Posts in selected categories.


/* Retrieve all tags from posts in selected categories */

$cats = array('beaches','mountains');  // Must be an array even if only one category
$cats_string = "'" . implode($cats,"','") . "'";
$sql = <<<EOSQL
FROM $wpdb->posts p
JOIN $wpdb->term_relationships tr ON p.ID = tr.object_id
JOIN $wpdb->term_taxonomy tt ON (tr.term_taxonomy_id = tt.term_taxonomy_id
       AND tt.taxonomy = 'post_tag')
JOIN $wpdb->terms t ON tt.term_id = t.term_id
   p.ID IN (
      SELECT p2.ID
      FROM $wpdb->posts p2
      JOIN $wpdb->term_relationships tr2 ON p2.ID = tr2.object_id
      JOIN $wpdb->term_taxonomy tt2 ON (tr2.term_taxonomy_id = tt2.term_taxonomy_id AND tt2.taxonomy = 'category')
      JOIN $wpdb->terms t2 ON (tt2.term_id = t2.term_id AND IN ($cats_string))
      WHERE p2.post_type = 'post'
      AND p2.post_status = 'publish'
      AND p2.post_date <= NOW()

$terms = $wpdb->get_results($sql);

// print_r($terms);

echo "<br />";
foreach ($terms as $term) {
   echo "ID:$term->term_id NAME:$term->name SLUG:$term->slug<br />";


Migrating A WordPress Site – Step By Step

These instructions are for sites that run Apache servers, either on Linux or XAMPP.  They may work with others, but have not been tested.

Whenever I develop a new site, or need to make extensive changes to an existing site, I like to do the work on a local install and then migrate the site to the live one.  This is a description of the process I use.  As of this writing, this has been used on WP versions 3.1 through 3.9.1.

Continue reading