web/wp-content/themes/elegant-box/links.php
author ymh <ymh.work@gmail.com>
Mon, 22 Mar 2010 16:36:28 +0100
changeset 5 ac511f1ccc8e
parent 1 0d28b7c10758
permissions -rw-r--r--
add hgignore

<?php
/*
Template Name: Links
*/
?>

<?php
	get_header();
	$linkcats = $wpdb->get_results("SELECT T1.name AS name FROM $wpdb->terms T1, $wpdb->term_taxonomy T2 WHERE T1.term_id = T2.term_id AND T2.taxonomy = 'link_category'");
?>

<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>

	<div class="post">
		<div class="title">
			<h2><?php the_title(); ?></h2>
			<div class="fixed"></div>
		</div>
		<div class="info">
			<?php edit_post_link(__('Edit', 'elegantbox'), '<span class="edit">', '</span>'); ?>
			<?php if ( $user_ID ) : ?>
				<span class="editlinks"><a href="<?php echo get_settings('siteurl'); ?>/wp-admin/link-manager.php"><?php _e('Edit links', 'elegantbox'); ?></a> |&nbsp;</span>
				<span class="addlink"><a href="<?php echo get_settings('siteurl'); ?>/wp-admin/link-add.php"><?php _e('Add link', 'blocks'); ?></a> |&nbsp;</span>
			<?php endif; ?>
			<span><?php _e('Update: ', 'elegantbox'); the_modified_time(__('F jS, Y', 'elegantbox')) ?></span>
			<div class="fixed"></div>
		</div>
		<div class="content">

			<?php if($linkcats) : foreach($linkcats as $linkcat) : ?>
				<div class="boxcaption"><h3><?php echo $linkcat->name; ?></h3></div>
				<div class="box linkcat">
					<ul>
						<?php
							$bookmarks = get_bookmarks('orderby=rand&category_name=' . $linkcat->name);
							if ( !empty($bookmarks) ) {
								foreach ($bookmarks as $bookmark) {
									echo '<li><a href="' . $bookmark->link_url . '" title="' . $bookmark->link_description . '">' . $bookmark->link_name . '</a></li>';
								}
							}
						?>
					</ul>
					<div class="fixed"></div>
				</div>
			<?php endforeach; endif; the_content(); ?>
			<div class="fixed"></div>

		</div>
	</div>

	<?php
		if (function_exists('wp_list_comments')) {
			comments_template('', true);
		} else {
			comments_template();
		}
	?>

<?php else : ?>
	<div class="messagebox">
		<div class="content small">
			<?php _e('Sorry, no posts matched your criteria.', 'elegantbox'); ?>
		</div>
	</div>

<?php endif; ?>
</div>

<?php get_sidebar(); ?>

<div class="fixed"></div>

	<div id="bottom">

<?php get_footer(); ?>