',
));
}
function themefunction_list_bookmarks() {
$array = array();
$array[] = 'class=box box-blogroll';
$array[] = 'category_before=
';
$array[] = 'category_after=
';
$array[] = 'title_before=';
$array[] = 'categorize=0';
$array[] = 'title_li=Blogroll';
wp_list_bookmarks(implode('&',$array));
}
function themefunction_list_pages_flat($args = '') {
$defaults = array(
'depth' => 0, 'show_date' => '',
'date_format' => get_option('date_format'),
'child_of' => 0, 'exclude' => '',
'title_li' => __('Pages'), 'echo' => 1,
'authors' => '', 'sort_column' => 'menu_order, post_title'
);
$r = wp_parse_args( $args, $defaults );
extract( $r, EXTR_SKIP );
$output = '';
$current_page = 0;
// sanitize, mostly to keep spaces out
$r['exclude'] = preg_replace('[^0-9,]', '', $r['exclude']);
// Allow plugins to filter an array of excluded pages
$r['exclude'] = implode(',', apply_filters('wp_list_pages_excludes', explode(',', $r['exclude'])));
// Query pages.
$r['hierarchical'] = 0;
$pages = get_pages($r);
if ( !empty($pages) ) {
if ( $r['title_li'] )
$output .= '
' . $r['title_li'] . '';
global $wp_query;
if ( is_page() || $wp_query->is_posts_page )
$current_page = $wp_query->get_queried_object_id();
$output .= themefunction_walk_page_tree($pages, $r['depth'], $current_page, $r);
}
$output = apply_filters('themefunction_list_pages_flat', $output);
if ( $r['echo'] )
echo $output;
else
return $output;
}
function themefunction_walk_page_tree() {
$tfwalker = new TF_Walker_Page;
$args = func_get_args();
return call_user_func_array(array(&$tfwalker, 'walk'), $args);
}
class TF_Walker_Page extends Walker {
var $tree_type = 'page';
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
function start_lvl($output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "\n$indent\n";
return $output;
}
function end_lvl($output, $depth) {
$indent = str_repeat("\t", $depth);
$output .= "$indent\n";
return $output;
}
function start_el($output, $page, $depth, $current_page, $args) {
if ( $depth )
$indent = str_repeat("\t", $depth);
else
$indent = '';
extract($args, EXTR_SKIP);
$css_class = 'page_item page-item-'.$page->ID;
if ( !empty($current_page) ) {
$_current_page = get_page( $current_page );
if ( in_array($page->ID, (array) $_current_page->ancestors) )
$css_class .= ' current_page_ancestor';
if ( $page->ID == $current_page )
$css_class .= ' current_page_item';
elseif ( $_current_page && $page->ID == $_current_page->post_parent )
$css_class .= ' current_page_parent';
}
$output .= $indent . '' . apply_filters('the_title', $page->post_title) . '';
if ( !empty($show_date) ) {
if ( 'modified' == $show_date )
$time = $page->post_modified;
else
$time = $page->post_date;
$output .= " " . mysql2date($date_format, $time);
}
return $output;
}
function end_el($output, $page, $depth) {
$output .= "\n";
return $output;
}
}
?>