admin管理员组文章数量:1389772
I would like to only display the archive subtitle on the first archive page. Now, it shows at the top of every page.
I am putting a lot of information with direct links in the subtitle of the tags (it's actually a custom taxonomy if that matters).
So basically the first archive page will give the user possibly all the information and specific links to posts that they may need.
However, the archive pages will provide a comprehensive way to find all the content that may have that tag.
Currently, index.php
seems to be what is generating my archive pages.
I'm guessing this is the part I need to modify:
if ( $archive_title || $archive_subtitle ) {
?>
<header class="archive-header has-text-align-center header-footer-group">
<div class="archive-header-inner section-inner medium">
<?php if ( $archive_title ) { ?>
<h1 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h1>
<?php } ?>
<?php if ( $archive_subtitle ) { ?>
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
<?php } ?><hr class="archive-head-separator styled-separator">
</div>
</header>
<?php
}
Is there a way to know what page of the archive it's on and somehow work that into an if statement around this bit?
if ( $archive_subtitle ) { ?>
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
}
Is that right?
I would like to only display the archive subtitle on the first archive page. Now, it shows at the top of every page.
I am putting a lot of information with direct links in the subtitle of the tags (it's actually a custom taxonomy if that matters).
So basically the first archive page will give the user possibly all the information and specific links to posts that they may need.
However, the archive pages will provide a comprehensive way to find all the content that may have that tag.
Currently, index.php
seems to be what is generating my archive pages.
I'm guessing this is the part I need to modify:
if ( $archive_title || $archive_subtitle ) {
?>
<header class="archive-header has-text-align-center header-footer-group">
<div class="archive-header-inner section-inner medium">
<?php if ( $archive_title ) { ?>
<h1 class="archive-title"><?php echo wp_kses_post( $archive_title ); ?></h1>
<?php } ?>
<?php if ( $archive_subtitle ) { ?>
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
<?php } ?><hr class="archive-head-separator styled-separator">
</div>
</header>
<?php
}
Is there a way to know what page of the archive it's on and somehow work that into an if statement around this bit?
if ( $archive_subtitle ) { ?>
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
}
Is that right?
Share Improve this question edited Mar 24, 2020 at 20:55 WordPress Speed 2,2833 gold badges19 silver badges34 bronze badges asked Mar 24, 2020 at 11:45 HopefullCoderHopefullCoder 456 bronze badges1 Answer
Reset to default 1is_paged()
can be used to tell if you are on any page other than the first page of an archive. You could use it like this:
<?php if ( $archive_subtitle && ! is_paged() ) { ?>
<div class="archive-subtitle section-inner thin max-percentage intro-text"><?php echo wp_kses_post( wpautop( $archive_subtitle ) ); ?></div>
<?php } ?>
本文标签: Only display archive subtitle on the first archive page
版权声明:本文标题:Only display archive subtitle on the first archive page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744641728a2617163.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论