All pastes #508677 Raw Edit

MellerTime

public php v1 · immutable
·published 2007-05-25 03:25 UTC
rendered paste body
	include('functions_pages.php');		wp_enqueue_script('prototype');	wp_enqueue_script('scriptaculous');		add_action('wp_head', 'add_build_page_tree');		function add_build_page_tree ( ) {				echo "<script type=\"text/javascript\" src=\"" . get_stylesheet_directory_uri() . '/azra_el_test.js' . "\"></script>\n";			}function build_page_tree ( $args = '' ) {	// this entire first part is stolen from wp_list_pages	if ( is_array($args) ) {		$r = &$args;	}	else {		parse_str($args, $r);	}		// setup the default options	$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 = array_merge($defaults, $r);	$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.	$pages = get_pages($r);	if ( !empty($pages) ) {		if ( $r['title_li'] )			$output .= '<li class="pagenav">' . $r['title_li'] . '<ul>';		global $wp_query;				if ( is_page() ) {			$current_page = $wp_query->get_queried_object_id();		}				// oh baby, here comes the good shit		$output .= walk_page_tree2($pages, $r['depth'], $current_page, $r);			}		if ( $r['echo'] )		echo $output;	else		return $output;}