Advertisements

get_day_link

Definition:
function get_day_link($year, $month, $day) {}

Retrieve the permalink for the day archives with year and month.

Parameters

  • bool|int $year: False for current year. Integer of year.
  • bool|int $month: False for current month. Integer of month.
  • bool|int $day: False for current day. Integer of day.

Defined filters

  • day_link
    apply_filters('day_link', home_url( user_trailingslashit($daylink, 'day')
  • day_link
    apply_filters('day_link', home_url( '?m=' . $year . zeroise($month, 2)

Source code

function get_day_link($year, $month, $day) {

	global $wp_rewrite;

	if ( !$year )

		$year = gmdate('Y', current_time('timestamp'));

	if ( !$month )

		$month = gmdate('m', current_time('timestamp'));

	if ( !$day )

		$day = gmdate('j', current_time('timestamp'));



	$daylink = $wp_rewrite->get_day_permastruct();

	if ( !empty($daylink) ) {

		$daylink = str_replace('%year%', $year, $daylink);

		$daylink = str_replace('%monthnum%', zeroise(intval($month), 2), $daylink);

		$daylink = str_replace('%day%', zeroise(intval($day), 2), $daylink);

		return apply_filters('day_link', home_url( user_trailingslashit($daylink, 'day') ), $year, $month, $day);

	} else {

		return apply_filters('day_link', home_url( '?m=' . $year . zeroise($month, 2) . zeroise($day, 2) ), $year, $month, $day);

	}

}

1354

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: