WordPress.org

Ready to get started?Download WordPress

Forums

change tag.php to show year-wise posts (2 posts)

  1. dee0954
    Member
    Posted 1 year ago #

    Hi

    In the codex i found:
    <select name="archive-dropdown" onchange="document.location.href=this.options[this.selectedIndex].value;">
    <option value=""><?php echo esc_attr( __( 'Select Year' ) ); ?></option>
    <?php wp_get_archives( array( 'type' => 'yearly', 'format' => 'option', 'show_post_count' => 1 ) ); ?>
    </select>

    Which lists posts by the year.
    What do i need to change in this to make it applicable only to the selected tag page?

  2. bcworkz
    Member
    Posted 1 year ago #

    wp_get_archives() cannot filter by tag terms as it stands. If you know mySQL and how to query by tag terms, you can hook the 'getarchives_where' and 'getarchives_join' filters to alter the the function's query to limit it to the desired tag terms.

Topic Closed

This topic has been closed to new replies.

About this Topic