1
|
1 |
<?php |
|
2 |
/* |
|
3 |
Template Name: Links |
|
4 |
*/ |
|
5 |
?> |
|
6 |
|
|
7 |
<?php |
|
8 |
get_header(); |
|
9 |
$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'"); |
|
10 |
?> |
|
11 |
|
|
12 |
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?> |
|
13 |
|
|
14 |
<div class="post"> |
|
15 |
<div class="title"> |
|
16 |
<h2><?php the_title(); ?></h2> |
|
17 |
<div class="fixed"></div> |
|
18 |
</div> |
|
19 |
<div class="info"> |
|
20 |
<?php edit_post_link(__('Edit', 'elegantbox'), '<span class="edit">', '</span>'); ?> |
|
21 |
<?php if ( $user_ID ) : ?> |
|
22 |
<span class="editlinks"><a href="<?php echo get_settings('siteurl'); ?>/wp-admin/link-manager.php"><?php _e('Edit links', 'elegantbox'); ?></a> | </span> |
|
23 |
<span class="addlink"><a href="<?php echo get_settings('siteurl'); ?>/wp-admin/link-add.php"><?php _e('Add link', 'blocks'); ?></a> | </span> |
|
24 |
<?php endif; ?> |
|
25 |
<span><?php _e('Update: ', 'elegantbox'); the_modified_time(__('F jS, Y', 'elegantbox')) ?></span> |
|
26 |
<div class="fixed"></div> |
|
27 |
</div> |
|
28 |
<div class="content"> |
|
29 |
|
|
30 |
<?php if($linkcats) : foreach($linkcats as $linkcat) : ?> |
|
31 |
<div class="boxcaption"><h3><?php echo $linkcat->name; ?></h3></div> |
|
32 |
<div class="box linkcat"> |
|
33 |
<ul> |
|
34 |
<?php |
|
35 |
$bookmarks = get_bookmarks('orderby=rand&category_name=' . $linkcat->name); |
|
36 |
if ( !empty($bookmarks) ) { |
|
37 |
foreach ($bookmarks as $bookmark) { |
|
38 |
echo '<li><a href="' . $bookmark->link_url . '" title="' . $bookmark->link_description . '">' . $bookmark->link_name . '</a></li>'; |
|
39 |
} |
|
40 |
} |
|
41 |
?> |
|
42 |
</ul> |
|
43 |
<div class="fixed"></div> |
|
44 |
</div> |
|
45 |
<?php endforeach; endif; the_content(); ?> |
|
46 |
<div class="fixed"></div> |
|
47 |
|
|
48 |
</div> |
|
49 |
</div> |
|
50 |
|
|
51 |
<?php |
|
52 |
if (function_exists('wp_list_comments')) { |
|
53 |
comments_template('', true); |
|
54 |
} else { |
|
55 |
comments_template(); |
|
56 |
} |
|
57 |
?> |
|
58 |
|
|
59 |
<?php else : ?> |
|
60 |
<div class="messagebox"> |
|
61 |
<div class="content small"> |
|
62 |
<?php _e('Sorry, no posts matched your criteria.', 'elegantbox'); ?> |
|
63 |
</div> |
|
64 |
</div> |
|
65 |
|
|
66 |
<?php endif; ?> |
|
67 |
</div> |
|
68 |
|
|
69 |
<?php get_sidebar(); ?> |
|
70 |
|
|
71 |
<div class="fixed"></div> |
|
72 |
|
|
73 |
<div id="bottom"> |
|
74 |
|
|
75 |
<?php get_footer(); ?> |