I have added a little extra functionality to the old Paper Trail script to allow for a pages parents child pages to be shown if required as in earlier versions. This is very useful if you have a collection of articles under a single banner such as the TBG tutorials here at this site. The code is as follows:
<?php if (function_exists(‘pollChildren’)) {
if ( get_post_meta($post->ID, “poll-dad”, true) == “TRUE” ) {
$post = $posts[0];
$dad = $post->post_parent;
$name = str_replace(“/”.$post->post_name,”",$_SERVER['REQUEST_URI']);
$nDad = $wpdb->get_results(“SELECT ID, post_title, post_name FROM wp_posts WHERE ID=”.$dad);
echo “<div class=’post-head’>”.$nDad[0]->post_title.” chapters</div>”;
echo “<ul class=’paper-trail-child’>”;
pollChildren($dad, $wpdb, $name );
echo “</ul>”;
}
} ?>
As you can see I am utilizing the get_post_meta() command to trigger the code. This means that I can call the function as and when required on any page that I assign the key “poll-dad” simple eh. For more information and additional usages for get_post_meta() command have a look at the adding an intro to wordpress pages post.
I have purposely kept this output separate from the main Paper Trail body as on occasion I think that I might like to have this facility without having to run Paper Trail itself. You will notice from the code that I have also migrated the existing code fully to function calls.
I will divulge more details on this when and if I get chance to write things up, however it should be pretty obvious to all those savvy folks out there though (use the wordpress functions.php).
say what do you think