0

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?

1

is_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 } ?>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.