把iNove主题的Links模板改成了按分类显示
iNove主题真的很精致,但是它的Links模板却不能按分类显示却让我很不爽,今天搞了搞,终于可以按分类显示了。
改后的links.php:
<?php
/*
Template Name: Links
*/
?>
<?php get_header(); ?>
<?php $options = get_option('inove_options'); ?>
<?php if (have_posts()) : the_post(); update_post_caches($posts); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2><?php the_title(); ?></h2>
<div class="info">
<span class="date"><?php the_modified_time(__('F jS, Y', 'inove')); ?></span>
<div class="act">
<?php if ($comments || comments_open()) : ?>
<span class="comments"><a href="#comments"><?php _e('Goto comments', 'inove'); ?></a></span>
<span class="addcomment"><a href="#respond"><?php _e('Leave a comment', 'inove'); ?></a></span>
<?php endif; ?>
<?php if ( $user_ID ) : ?>
<span class="editlinks"><a href="<?php echo get_settings('home'); ?>/wp-admin/link-manager.php"><?php _e('Edit links', 'inove'); ?></a></span>
<?php endif; ?>
<?php edit_post_link(__('Edit', 'inove'), '<span class="editpost">', '</span>'); ?>
<div class="fixed"></div>
</div>
<div class="fixed"></div>
</div>
<div class="content">
<?php
$output = '';
$cats = get_terms('link_category');
foreach ( (array) $cats as $cat ) {
$bookmarks = get_bookmarks(array('category'=>$cat->term_id));
if ( empty($bookmarks) )
continue;
$catname = apply_filters( "link_category", $cat->name );
$output .= '<div class="boxcaption"><h3>';
$output .= $catname;
$output .= '</h3></div>';
$output .= "\n";
$output .= '<div class="box linkcat">';
$output .= "\n";
$output .= '<ul>';
$output .= "\n";
$output .= _walk_bookmarks($bookmarks);
$output .= '</ul>';
$output .= "\n";
$output .= '<div class="fixed"></div>';
$output .= "\n";
$output .= '</div>';
$output .= "\n";
}
echo $output;
?>
<?php the_content(); ?>
<div class="fixed"></div>
</div>
</div>
<?php else : ?>
<div class="errorbox">
<?php _e('Sorry, no posts matched your criteria.', 'inove'); ?>
</div>
<?php endif; ?>
<?php include('templates/comments.php'); ?>
<?php get_footer(); ?>

inove不错