Codeable info

Making a WordPress Unposts

Posted on by in WordPress Tutorials

True to its blogging roots, WordPress’s atomic unit of information — the humble post — is well-suited to maintaining the stereotype to which WordPress falls victim. In short: “WordPress? It’s just a blog.”

Plugins, themes, and widgets go far to dressing the venerable CMS as a fully-fledged website platform, but fail to hide the fact that at least half of WordPress is dedicated to managing articles arranged in chronological order and grouped into categories. As long as WordPress retains its blog-like structure, arguing otherwise is an uphill battle.

Thinking beyond the stereotype, how else can designers use WordPress? The problem is not “how do we use posts to imitate a non-WordPress site?” Rather, “what other types of sites can we build with posts?”

Rethinking the Post

Databases have fields. HTML has elements. Drupal has nodes. Images have pixels. Each digital medium or platform has a base nugget of data: an indivisible unit of information. Many such units can be combined to create meaningful information, like fields into rows or pixels into pictures.

Certainly a WordPress post may be divided into paragraphs or sections with HTML. But as a concept, posts are fundamental blocks on which WordPress-powered sites operate. Even pages are stored in the wp_posts table. Tags, comments, and categories are useless until related to one or more posts.

But posts are not units in the traditional sense. Typically a datum out of context is meaningless. “50 people” may specify a quantity, but “50 people ran a marathon” gives the quantity meaning. By contrast, WordPress posts are meant to stand alone, not work together. Administrators may corral posts into groups with tags and categories, but posts are rarely used to build more than an archive or search results page. One full post occupies a post page — that’s why WordPress ships with “single.php”, not “multiple.php.”

At least, that’s common wisdom. But to tread worn paths isn’t always smart. To think of WordPress beyond a highly flexible blog, we must reconsider what “post” is and how it works.

  1. Perception: A post is an entire standalone article.
  2. New thinking: A post is a snippet of text.

  3. Perception: A page template shows one post.
  4. New thinking: Many posts comprise one page.

  5. Perception: Categories and tags organize posts by topic.
  6. New thinking: Working together, categories and tags are content; posts provide supplemental information.

  7. Perception: Posts naturally list chronologically.
  8. New thinking: Posts list by a variety of criteria.

When we think of posts not as a stream of articles, but as nuggets of information, possibilities emerge.

What if?

Collective ad-libs

This new take on traditional word clouds creates a focused message to which anyone may contribute. But rather than show comments as a running list, this approach keeps it short.

Properties of WordPress:

  1. Tags apply to more than one post. They create overlapping relationships of content.
  2. People can comment on posts. A post may have many comments, but each comment may only apply to one post.

Write a series of posts as incomplete sentences. For example:

  • “The biggest problem was…”
  • “The sun was so bright…”
  • “I thought there was no way I would ever…”
  • “I like music that…”

Encourage people to complete these sentences in the comments. Avoid run-on comments by warning people that their entries will be limited to tweet-length.

Then show only the single most recent comment for each post in a tag.

function fetch_latest_comment($post_id=0){
	global $wpdb;
	if ( $post_id > 0 ) {
		$query = "
SELECT
	comment_ID,
	comment_content
FROM
	$wpdb->comments
WHERE
	comment_post_id = '$post_id' AND 
	comment_approved = '1'
ORDER BY
	comment_date DESC
LIMIT
	1";
		$latest_comment = $wpdb->get_results($query);
	}
	if ( $latest_comment ) {
		return $latest_comment[0]->comment_content;
	}
	return null;
}
 
// Example: Given three posts with IDs 101, 102, 103.
$person = fetch_latest_comment('101');
 
$occupation = fetch_latest_comment('102');
 
$event = fetch_latest_comment('103');
 
print ( 'There once was a '.$person.' who '.$occupation.' until they '.$event.'.' );
 
// Give people options to edit a word.
print ( '<a href="?p=8">Change person</a>' );
print ( '<a href="?p=102">Change occupation</a>' );
print ( '<a href="?p=103">Change event</a>' );

Evolution explained

If your work evolves over time, and you want to share your creative process, then save each version of a work as a distinct post. Each “article” is really a category where each post is a different version organized by date. Using posts’ primary images, this also works for photos and graphics.

Properties of WordPress:

  1. Every post has a date.
  2. Every post may belong to a category.
  3. Category names are as long as titles.

unpost versions

Everything is a Post

In many content management systems, pages are single blocks of content edited with a WYSIWYG editor. But one size does not fit all. Headers, footers, and distinct areas of content can be edited separately and reused throughout the site.

At the same time, not every site owner is HTML-savvy. Let them edit any part of their site by creating common elements as posts.

Properties of WordPress:

  1. Posts are easy to edit.
  2. Pages are meant to hold static content.

As a bonus, we can use tags to call on headers or footers specially designed for holidays or special events.

function fetch_post_by_tags($tag_set=array()){
	if ( is_array($tag_set) && count($tag_set) > 0 ) {
		$tag_set = implode('+',$tag_set); // Plus to require all, comma to require any.
		$post = new WP_Query('tag='.$tag_set.'&showposts=1');
	}
	return $post;
}
 
// Leading up to Halloween
if ( date('n') == 10 ) {
	$site_header = fetch_post_by_tags ( array ('header','halloween') );
	$site_footer = fetch_post_by_tags ( array ('footer','halloween') );
}
 
// St. Patrick's Day
elseif ( date('n-j') == '3-18' ) {
	$site_header = fetch_post_by_tags ( array ('header','st-patricks-day') );
	$site_footer = fetch_post_by_tags ( array ('footer','st-patricks-day') );
}
 
// Special notice about SxSW
elseif ( date('n') == 3 && date('j') <= 7 ) {
	$site_header = fetch_post_by_tags ( array ('header','sxsw') );
	$site_footer = fetch_post_by_tags ( array ('footer','sxsw') );
}
 
// Towel day
elseif ( date('n-j') == '5-25' ) {
	$site_header = fetch_post_by_tags ( array ('header','towel-day') );
	$site_footer = fetch_post_by_tags ( array ('footer','towel-day') );
}
 
// Default
else {
	$site_header = fetch_post_by_tags ( array ('header','normal') );
	$site_footer = fetch_post_by_tags ( array ('footer','normal') );
}
 
// Place these in the appropriate header file(s).
print(''); // Make it easy to look up which specific post created this.
print($site_header->posts[0]->post_content);
 
// Place these in the appropriate footer file(s).
print(''); // Make it easy to look up which specific post created this.
print($site_footer->posts[0]->post_content);

Bookmarks

Create your own bookmark sharing system by using posts as topics — and ignoring post content.

Properties of WordPress:

  1. Anyone may comment on a post.
  2. Posts have titles.
function fetch_post_comments($post_id=0){
	global $wpdb;
	if ( $post_id > 0 ) {
		$query = "
SELECT
	comment_ID,
	comment_content
FROM
	$wpdb->comments
WHERE
	comment_post_id = '$post_id' AND 
	comment_approved = '1'
ORDER BY
	comment_date DESC
";
		$comment_list = $wpdb->get_results($query);
		return $comment_list;
	}
}
 
function format_comment_list($comment_list=array()){
	if ( $comment_list && count($comment_list) > 0 ) {
		$output = '<ul>'."\n";
		foreach ( $comment_list as $particular_comment ) {
			$output .= '<li>'.$particular_comment->comment_content.'</li>'."\n";
		}
		$output .= '</ul>'."\n";
	}
	else {
		$output = "<p>No one's contributed to this topic yet.</p>";
	}
	return $output;
}
 
// Each "topic" is a post. The examples below use fictitious post IDs 1, 12, and 42.
 
// First topic
$title_1 = get_the_title('8');
$comment_list = fetch_post_comments('8');
$comments_to_show_1 = format_comment_list($comment_list);
 
// Second topic
$title_2 = get_the_title('12');
$comment_list = fetch_post_comments('12');
$comments_to_show_2 = format_comment_list($comment_list);
 
// Third topic
$title_3 = get_the_title('42');
$comment_list = fetch_post_comments('42');
$comments_to_show_3 = format_comment_list($comment_list);
 
 
 
print ( '<h1>'.$title_1.'</h1>');
print ( '<div>'.$comments_to_show_1.'</div>');
print ( '<p><a href="?p=1">contribute</a>');
 
print ( '<h1>'.$title_2.'</h1>');
print ( '<div>'.$comments_to_show_2.'</div>');
print ( '<p><a href="?p=12">contribute</a>');
 
print ( '<h1>'.$title_3.'</h1>');
print ( '<div>'.$comments_to_show_3.'</div>');
print ( '<p><a href="?p=42">contribute</a>');

Going Forward

Like WordPress itself, posts are not limited to their original purpose. There’s no trick to thinking beyond “WordPress is just a blog.” Just imagine a site that does not box information into articles. How else will you counter the declaration that WordPress is just a blog?

)
Codeable info

Comments (1)

Comment by Konrad Tadesse says:

Hello Ben Gremillion,
your article is very interesting!
But I do not understand. “Everything is a Post”, “Evolution explained” or “Bookmarks”.
On my website content is in image media, categories, tags and taxonomies. There is no content in the post itself, it all gets collected through tags etc.

I do not use link content or comments jet.

Comments: how would you use Comments?

Images: how would you use image description?

Konrad, Berlin

Codeable info