All pastes #896669 Raw Edit

Anonymous

public text v1 · immutable
·published 2008-02-08 21:35 UTC
rendered paste body
<?php


if ( function_exists('register_sidebar') )
	register_sidebar(array(
		'name' => 'Right Sidebar',
		'before_widget' => '', // Removes <li>
		'after_widget' => '', // Removes </li>
		'before_title' => '<h2>',
		'after_title' => '</h2>',
	));



	function widget_swiss_p_pagenav() {
?>
<h2 class="hide">Site menu:</h2>
<ul class="page">
<?php if (is_page()) { $highlight = "page_item"; } else {$highlight = "page_item current_page_item"; } ?>
<li class="<?php echo $highlight; ?>"><a href="<?php bloginfo('url'); ?>">Home</a></li>
<?php wp_list_pages('sort_column=menu_order&depth=1&title_li='); ?>
</ul>
<?php
}
if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Pages'), 'widget_swiss_pagenav');




         function widget_swiss_search() {
?>
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
<?php
}

if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Search'), 'widget_swiss_search');


	function widget_swiss_links() {
?>

<ul class="menulist">
<?php get_links_list(); ?>
</ul>
<?php
}
if ( function_exists('register_sidebar_widget') )
    register_sidebar_widget(__('Links'), 'widget_swiss_links');


function list_subpages_swiss($return = 0) {
global $wpdb, $post;
$current_page = $post->ID;
while($current_page) {
$page_query = $wpdb->get_row("SELECT ID, post_title, post_parent FROM $wpdb->posts WHERE ID = '$current_page'");
$current_page = $page_query->post_parent; }
$parent_id = $page_query->ID;
$parent_title = $page_query->post_title;
if($wpdb->get_results("SELECT * FROM $wpdb->posts WHERE post_parent = '$parent_id'")) {
echo'<div id="subpages"><h2>Subpages for '; echo $parent_title; echo':</h2> <ul class="submenu">';
$html = wp_list_pages("child_of=$parent_id&depth=$depth&echo=".(!$return)."&title_li=0&sort_column=menu_order");
echo'</ul></div>'; }
if($return) {
return $html;
} else {
echo $html; } }
?>