admin管理员组文章数量:1327665
I have created the category page using category.php
template where I have pull the category description. I can see the code is working fine as some of the category description are pulling in the front-end while some of the category description is not showing in category page. I could not find any solution for it.
Here is what I have tried:
- Updated the category description of the category which is not pulling in category page.
- I also tried to verify slug conflict by renaming the slug but still its not working.
Below is the code in my category.php file to pull the category description:
<?php if(is_tag()){ ?>
<p><?php
$categories = get_the_tags();
echo $categories[0]->description;
?></p>
<?php } else { ?>
<p><?php
$categories = get_the_category();
echo $categories[0]->description;
?></p>
<?php } ?>
I have created the category page using category.php
template where I have pull the category description. I can see the code is working fine as some of the category description are pulling in the front-end while some of the category description is not showing in category page. I could not find any solution for it.
Here is what I have tried:
- Updated the category description of the category which is not pulling in category page.
- I also tried to verify slug conflict by renaming the slug but still its not working.
Below is the code in my category.php file to pull the category description:
<?php if(is_tag()){ ?>
<p><?php
$categories = get_the_tags();
echo $categories[0]->description;
?></p>
<?php } else { ?>
<p><?php
$categories = get_the_category();
echo $categories[0]->description;
?></p>
<?php } ?>
Share
Improve this question
edited Jul 28, 2020 at 12:50
fuxia♦
107k38 gold badges255 silver badges459 bronze badges
asked Jul 28, 2020 at 12:05
Sushil ShresthaSushil Shrestha
31 bronze badge
1 Answer
Reset to default 1You can use pre-defined function to get a category description.
category_description();
Visit for more information to Retrieve category description.
本文标签: categoriesSome of the category description not showing up in category page
版权声明:本文标题:categories - Some of the category description not showing up in category page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742226687a2436449.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论