You are currently browsing the post archives for December 2008.

Create Accessible Attachment Links

Posted on December 4, 2008 at 1:20 pm in

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: the post ID the associated image size (‘thumbnail’ or ‘medium’) option to display the attachment’s permalink (boolean — ‘false’ or ‘true’) option…

Create Attachment Viewer Links

Posted on December 4, 2008 at 12:50 pm in

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

Comments are off for Create Attachment Viewer Links »

Create A Breadcrumb Trail

Posted on December 4, 2008 at 12:44 pm in

<?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>’; }?>

Comments are off for Create A Breadcrumb Trail »

Show Page Children

Posted on December 4, 2008 at 12:41 pm in

<?php // Show all children of a page if($post->post_parent) $children = wp_list_pages(“title_li=&child_of=”.$post->post_parent.”&echo=0″); else $children = wp_list_pages(“title_li=&child_of=”.$post->ID.”&echo=0″); if ($children) { echo ‘<li class=”sub_pages”>Child Pages<ul>’.”\n”; echo $children; echo “</ul></li>\n”; }?>

Get Page Parent

Posted on December 4, 2008 at 12:39 pm in

<?php // Get the parent of a page $this_post = get_post($post->ID,ARRAY_A); if($this_post['post_type'] == ‘page’) { $this_parent_id = $this_post['post_parent']; if($this_parent_id > 0) { $this_parent = get_page($this_parent_id,ARRAY_A); $this_parent_title = $this_parent['post_title']; $this_parent_uri = get_page_uri($this_parent_id); $this_parent_link = ‘<a href=”‘.$this_parent_uri.’”>’.$this_parent_title.’</a>’; echo $this_parent_link; } }?>

Comments are off for Get Page Parent »

WordPress Theme Development

Top