admin管理员组文章数量:1130349
I want display category description only the first page:
I use in my category.php:
<?php if(category_description()) :?>
<section class="cat-desc">
<?php echo category_description(); ?>
</section>
<?php endif; ?>
I try this:
<?
if (is_category()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page == 1) {
echo category_description(); //you don't need to include the category id
on the actual category page - wordpress figures it out.
}
}
?>
<?
if (is_tag()) {
$page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page2 == 1) {
echo tag_description(); //you don't need to include the category id on the
actual category page - wordpress figures it out.
}
}
?>
With the Category description is all ok but the tag description is missing.
Thanks.
I want display category description only the first page:
I use in my category.php:
<?php if(category_description()) :?>
<section class="cat-desc">
<?php echo category_description(); ?>
</section>
<?php endif; ?>
I try this:
<?
if (is_category()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page == 1) {
echo category_description(); //you don't need to include the category id
on the actual category page - wordpress figures it out.
}
}
?>
<?
if (is_tag()) {
$page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page2 == 1) {
echo tag_description(); //you don't need to include the category id on the
actual category page - wordpress figures it out.
}
}
?>
With the Category description is all ok but the tag description is missing.
Thanks.
Share Improve this question asked Nov 15, 2018 at 4:02 JesúsJesús 31 bronze badge 2 |1 Answer
Reset to default 0After adding descriptions to your tags, modify your WordPress theme to display the description at the top of each archive page. Open the "Appearance" section of your WordPress website's main menu and select "Editor." Click the "tag.php" link under "Tag Template" on the right side of the page.
I want display category description only the first page:
I use in my category.php:
<?php if(category_description()) :?>
<section class="cat-desc">
<?php echo category_description(); ?>
</section>
<?php endif; ?>
I try this:
<?
if (is_category()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page == 1) {
echo category_description(); //you don't need to include the category id
on the actual category page - wordpress figures it out.
}
}
?>
<?
if (is_tag()) {
$page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page2 == 1) {
echo tag_description(); //you don't need to include the category id on the
actual category page - wordpress figures it out.
}
}
?>
With the Category description is all ok but the tag description is missing.
Thanks.
I want display category description only the first page:
I use in my category.php:
<?php if(category_description()) :?>
<section class="cat-desc">
<?php echo category_description(); ?>
</section>
<?php endif; ?>
I try this:
<?
if (is_category()) {
$page = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page == 1) {
echo category_description(); //you don't need to include the category id
on the actual category page - wordpress figures it out.
}
}
?>
<?
if (is_tag()) {
$page2 = (get_query_var('paged')) ? get_query_var('paged') : 1;
if ($page2 == 1) {
echo tag_description(); //you don't need to include the category id on the
actual category page - wordpress figures it out.
}
}
?>
With the Category description is all ok but the tag description is missing.
Thanks.
Share Improve this question asked Nov 15, 2018 at 4:02 JesúsJesús 31 bronze badge 2-
Are you sure the tag actually has a description? And
category.phpis for category archives - for tag archives, usetag.php. – Sally CJ Commented Nov 15, 2018 at 5:06 - Thnaks!! I addes tag.php (my theme wasnt added it). – Jesús Commented Nov 15, 2018 at 8:33
1 Answer
Reset to default 0After adding descriptions to your tags, modify your WordPress theme to display the description at the top of each archive page. Open the "Appearance" section of your WordPress website's main menu and select "Editor." Click the "tag.php" link under "Tag Template" on the right side of the page.
本文标签: categoriesDisplay Category description
版权声明:本文标题:categories - Display Category description 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749179894a2328424.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


category.phpis for category archives - for tag archives, usetag.php. – Sally CJ Commented Nov 15, 2018 at 5:06