📜  the_archive_title() (1)

📅  最后修改于: 2023-12-03 15:20:37.391000             🧑  作者: Mango

the_archive_title()

the_archive_title() is a WordPress template tag that returns the title of the current archive page. It can be used to display the title of the year, month, or day archive page, as well as the category, tag, or author archive page.

Usage
the_archive_title( $before = '', $after = '' );

The the_archive_title() function takes two optional parameters:

  • $before (string) - text to display before the title
  • $after (string) - text to display after the title

The default value for both parameters is an empty string.

Here's an example of how to use the_archive_title() to display the title of a monthly archive page:

<h1><?php the_archive_title( '', ' archives' ); ?></h1>

This code will output something like "December 2021 archives". The $before parameter is left empty, and the $after parameter is set to " archives".

Markdown

Here's an example of how to format the usage example in Markdown:

# `the_archive_title()`

`the_archive_title()` is a WordPress template tag that returns the title of the current archive page. It can be used to display the title of the year, month, or day archive page, as well as the category, tag, or author archive page.

## Usage

```php
<h1><?php the_archive_title( '', ' archives' ); ?></h1>

This code will output something like "December 2021 archives". The $before parameter is left empty, and the $after parameter is set to " archives".


Note that the code is enclosed in backticks to indicate that it is code, and the example output is included in a code block.