<?php

// Using hooks is absolutely the smartest, most bulletproof way to implement things like plugins,
// custom design elements, and ads. You can add your hook calls below, and they should take the 
// following form:
// add_action('thesis_hook_name', 'function_name');
// The function you name above will run at the location of the specified hook. The example
// hook below demonstrates how you can insert Thesis' default recent posts widget above
// the content in Sidebar 1:
// add_action('thesis_hook_before_sidebar_1', 'thesis_widget_recent_posts');

// Delete this line, including the dashes to the left, and add your hooks in its place.

/**
 * function custom_bookmark_links() - outputs an HTML list of bookmarking links
 * NOTE: This only works when called from inside the WordPress loop!
 * SECOND NOTE: This is really just a sample function to show you how to use custom functions!
 *
 * @since 1.0
 * @global object $post
*/

function custom_bookmark_links() {
	global $post;
?>
<ul class="bookmark_links">
	<li><a rel="nofollow" href="http://delicious.com/save?url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>" onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=<?php urlencode(the_permalink()); ?>&amp;title=<?php urlencode(the_title()); ?>', 'delicious', 'toolbar=no,width=550,height=550'); return false;" title="Bookmark this post on del.icio.us">Bookmark this article on Delicious</a></li>
</ul>
<?php
}


function thesis_nav_menu_footer() {
	global $thesis;
	$home_text = thesis_home_link_text();
	$home_nofollow = ($thesis['nav']['home']['nofollow']) ? ' rel="nofollow"' : '';

	echo '<div class="back"><ul id="tabsfooter">' . "\n";
	
	if ($thesis['nav']['home']['show'] || $_GET['template']) {
		if (is_front_page()) {
			$current_page = get_query_var('paged');
			$home_class = ($current_page <= 1) ? 'home-item current_page_item' : 'home-item';
		}
		else
			$home_class = (is_home() && is_front_page()) ? 'home-item current_page_item' : 'home-item';

		echo '<li class="' . $home_class . '"><a href="' . get_bloginfo('url') . '" title="' . $home_text . '"' . $home_nofollow . '>' . $home_text . '</a></li>' . "\n";
	}
	
	$item_num = 1;

	if ($thesis['nav']['pages']) {
		if (!$thesis['nav']['style']) {
			global $wp_query;
			foreach ($thesis['nav']['pages'] as $id => $nav_page) {
				if ($nav_page['show']) {
					$page = get_page($id);
					$page_item = 'page-item-' . $item_num;
					$class = (is_page($id) || ($wp_query->is_posts_page && get_option('show_on_front') == 'page' && get_option('page_for_posts') == $id) || (get_option('show_on_front') == 'page' && get_option('page_on_front') == $id)) ? $page_item . ' current_page_item' : $page_item;
					$link_text = ($thesis['nav']['pages'][$id]['text'] != '') ? $thesis['nav']['pages'][$id]['text'] : $page->post_title;
					echo '<li class="' . $class . '"><a href="' . get_page_link($id) . '" title="' . $page->post_title . '">' . $link_text . '</a></li>' . "\n";
					$item_num++;
				}
			}
		}
		else {
			foreach ($thesis['nav']['pages'] as $id => $nav_page) {
				if ($nav_page['show'])
					$nav_array[] = $id;
			}

			$nav_menu_pages = implode(',', $nav_array);
			wp_list_pages('title_li=&include=' . $nav_menu_pages);
		}
	}
	
	if ($thesis['nav']['categories'])
		wp_list_categories('title_li=&include=' . $thesis['nav']['categories']);
	
	if ($thesis['nav']['links']) {
		$nav_links = get_bookmarks('category=' . $thesis['nav']['links']);

		foreach ($nav_links as $nav_link) {
			if ($nav_link->link_description)
				$title = ' title="' . $nav_link->link_description . '"';
			if ($nav_link->link_rel)
				$rel = ' rel="' . $nav_link->link_rel . '"';
			if ($nav_link->link_target)
				$target = ' target="' . $nav_link->link_target . '"';
			
			echo '<li><a href="' . $nav_link->link_url . '"' . $title . $rel . $target . '>' . $nav_link->link_name . '</a></li>' . "\n";
		}
	}
	
	if ($thesis['nav']['feed']['show'] || $_GET['template']) {
		$feed_title = get_bloginfo('name') . ' RSS Feed';
		$feed_nofollow = ($thesis['nav']['feed']['nofollow']) ? ' rel="nofollow"' : '';

		echo '<li class="rss"><a href="' . thesis_feed_url() . '" title="' . $feed_title . '"' . $feed_nofollow . '>' . thesis_feed_link_text() . '</a></li>' . "\n";
	}
		
	echo '</ul></div><div class="forward"><p class="right" style="font-size:10px;">&#169; '. date("Y") .' The Wellman Method,<br /><a href="http://www.dennisonwolfe.com/" target="_blank">Design and development</a> by Dennison+Wolfe Internet Group</p></div><br class="clearBoth" />' . "\n";
}


/* MOVING NAV BELOW HEADER */
remove_action('thesis_hook_before_header', 'thesis_nav_menu');
add_action('thesis_hook_after_header', 'thesis_nav_menu');

/* CUSTOM FOOTER HOOK */

remove_action('thesis_hook_footer', 'thesis_attribution');

function add_custom_footer () { ?>

<p class="right">&#169; <?php echo date("Y"); ?> The Wellman Method</p>
<?php }

//add_action('thesis_hook_footer', 'add_custom_footer');
add_action('thesis_hook_footer', 'thesis_nav_menu_footer');
