Wordpress

Simple Sitemap

December 4, 2008 - 1:49 pm

On sites where Wordpress is being used as a simple Content Management System, it may be appropriate to create a site map page.

One way of achieving this — without resorting to a plugin — is to create a sitemap template within the site’s theme. It is a little trickier than usual because the template has to incorporate a secondary Loop but, once you’ve figured out how to do this, it’s a trick that can come in handy elsewhere.

Simple Sitemap - continue reading …

Comment on Simple Sitemap

Attachment Templates

December 4, 2008 - 1:30 pm

If you want different layouts for different attachment file pages, you can include specific attachment templates within a theme based on the first part of the attachment MIME type.

Attachment Templates - continue reading …

Comment on Attachment Templates

Create Accessible Attachment Links

December 4, 2008 - 1:20 pm

You can use the Wordpress wp_get_attachment_link and get_attached_file functions in a number of ways to generate accessible download links — including outputting the file size and type.

The wp_get_attachment_link function has 4 parameters:

  1. the post ID
  2. the associated image size (’thumbnail’ or ‘medium’)
  3. option to display the attachment’s permalink (boolean — ‘false’ or ‘true’)
  4. option to display an associated image icon (boolean — ‘false’ or ‘true’)

Create Accessible Attachment Links - continue reading …

Comment on Create Accessible Attachment Links

Create Attachment Viewer Links

December 4, 2008 - 12:50 pm

Create links to freely available plugins/applications for attachment files based upon the attachment MIME type.

Create Attachment Viewer Links - continue reading …

Comment on Create Attachment Viewer Links

Create A Breadcrumb Trail

December 4, 2008 - 12:44 pm

<?php // Create a breadcrumb trail
$curr_id = get_post($post->ID);
$parent_id = $curr_id->post_parent;
if ($parent_id != 0) {
	$parent = get_post($parent_id);
	echo '<ul class="breadcrumb"><li><a href="'.get_bloginfo('url').'">Home</a> »</li>';
	echo '<li><a href="'.$parent->guid.'">'.$parent->post_title.'</a> »</li>';
	echo '<li>'.$curr_id->post_title.'</li></ul>';
}?>

Comment on Create A Breadcrumb Trail

Top