wpseek.com
Eine auf WordPress spezialiserte Suchmaschine für Entwickler und Theme-Autoren



get_year_link › WordPress Function

Seit1.5.0
Veraltetn/v
get_year_link ( $year )
Parameter:
  • (int|false) $year Integer of year. False for current year.
    Erforderlich: Ja
Gibt zurück:
  • (string) The permalink for the specified year archive.
Definiert in:
Codex:

Retrieves the permalink for the year archives.



Quellcode

function get_year_link( $year ) {
	global $wp_rewrite;
	if ( ! $year ) {
		$year = current_time( 'Y' );
	}
	$yearlink = $wp_rewrite->get_year_permastruct();
	if ( ! empty( $yearlink ) ) {
		$yearlink = str_replace( '%year%', $year, $yearlink );
		$yearlink = home_url( user_trailingslashit( $yearlink, 'year' ) );
	} else {
		$yearlink = home_url( '?m=' . $year );
	}

	/**
	 * Filters the year archive permalink.
	 *
	 * @since 1.5.0
	 *
	 * @param string $yearlink Permalink for the year archive.
	 * @param int    $year     Year for the archive.
	 */
	return apply_filters( 'year_link', $yearlink, $year );
}