2013-04-25 51 views
0

如何显示分类标题及其各自的链接和内容。在搜索页面显示带有链接的分类名称

我有我的代码,并在帖子的内容工作,但不能在该类别的标题/链接本

一些链接:

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


<?php if (have_posts()) : ?> 
    <?php while (have_posts()) : the_post(); ?> 
    <?php 
    echo '<a href="'. get_category_link($current_cat_id). '>'. the_category(' ').'</a> '; ?>      
    the_title(); 
    the_excerpt();  
<?php endwhile; ?> 


    <?php else : ?> 

     <h2>No posts found.</h2> 

    <?php endif; ?> 

回答

0

我做使用此代码解决此问题

<?php echo '<a href="' . get_category_link($category->term_id) . '" title="' . sprintf(__("View all posts in %s"), $category->name) . '" ' . '>' . the_category(" ").'</a> '; ?> 
相关问题