用于类别使用single_cat_title
功能:
http://codex.wordpress.org/Function_Reference/single_cat_title
用于标记使用single_tag_title
功能:
http://codex.wordpress.org/Function_Reference/single_tag_title
用于日期使用get_the_date
功能:
http://codex.wordpress.org/Function_Reference/get_the_date
例如,如果打开twentyten主题,您将看到以下内容:
类别php:
<h1 class="page-title"><?php
printf( __( \'Category Archives: %s\', \'twentyten\' ), \'<span>\' . single_cat_title( \'\', false ) . \'</span>\' );
?></h1>
日期。php:
<h1 class="page-title">
<?php if ( is_day() ) : ?>
<?php printf( __( \'Daily Archives: <span>%s</span>\', \'twentyten\' ), get_the_date() ); ?>
<?php elseif ( is_month() ) : ?>
<?php printf( __( \'Monthly Archives: <span>%s</span>\', \'twentyten\' ), get_the_date( _x( \'F Y\', \'monthly archives date format\', \'twentyten\' ) ) ); ?>
<?php elseif ( is_year() ) : ?>
<?php printf( __( \'Yearly Archives: <span>%s</span>\', \'twentyten\' ), get_the_date( _x( \'Y\', \'yearly archives date format\', \'twentyten\' ) ) ); ?>
<?php else : ?>
<?php _e( \'Blog Archives\', \'twentyten\' ); ?>
<?php endif; ?>
</h1>