[英]Wordpress category link redirecting to uncategorized instead of that category
wordpress category link redirecting to uncategorized.. in this case test as i changed uncategorized category name to test instead of that specific category wordpress 类别链接重定向到未分类.. 在这种情况下测试,因为我将未分类的类别名称更改为测试而不是特定类别
here is my code这是我的代码
<?php while(have_posts()){
the_post();
?>
<article class="blog_item">
<div class="blog_item_img">
<img src="<?php the_post_thumbnail_url('blogHome'); ?>" alt="fastinfo">
<span class="ribbon3 text-center"><a href=""><?php the_time('n-j-y');//the_date('d-m-y'); ?></a></span>
</div><!--blog_item_img-->
<div class="blog_details clearfix">
<a href="<?php the_permalink(); ?>" class="blog-post-heading">
<h2><?php the_title(); ?></h2>
</a>
<p><?php echo wp_trim_words(get_the_excerpt(),29);?></p>
<ul class="blog-info-link float-left mt-2">
<?php
$category = get_the_category( $id );
$category_link = get_category_link($category);
//echo $category[0]->cat_name;
?>
<li><a href="<?php echo esc_url($category_link);?>"><i class="fa fa-user"></i><?php echo $category[0]->cat_name;?></a></li>
<li><a href=""><i class="fa fa-comments"></i><?php comments_number( '0', '1', '%' ); ?>.</a></li>
</ul>
<a href="<?php the_permalink(); ?>" class="btn btn-spa float-right">Read More</a>
</div><!--blog_details-->
</article><!--blog_item-->
<?php } wp_reset_postdata();?>
i have archive.php..tried making category.php but nothing works我有存档。php..尝试制作 category.php 但没有任何效果
see screenshot of url while working on localhost在 localhost 上工作时查看 url 的屏幕截图
what am i doing wrong?我究竟做错了什么?
I got this resolved using this <?php echo get_the_category_list(', ');?>
我用这个解决了这个问题
<?php echo get_the_category_list(', ');?>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.