Switch language

wpseek.com
A WordPress-centric search engine for devs and theme authors




get_month_link [ WordPress Function ]

get_month_link ( $year, $month )
Parameters:
  • (bool|int) $year False for current year. Integer of year.
  • (bool|int) $month False for current month. Integer of month.
Returns:
  • (string)
Defined at:



Retrieve the permalink for the month archives with year.

Source


<?php
function get_month_link($year$month) {
    global 
$wp_rewrite;
    if ( !
$year )
        
$year gmdate('Y'current_time('timestamp'));
    if ( !
$month )
        
$month gmdate('m'current_time('timestamp'));
    
$monthlink $wp_rewrite->get_month_permastruct();
    if ( !empty(
$monthlink) ) {
        
$monthlink str_replace('%year%'$year$monthlink);
        
$monthlink str_replace('%monthnum%'zeroise(intval($month), 2), $monthlink);
        return 
apply_filters('month_link'home_urluser_trailingslashit($monthlink'month') ), $year$month);
    } else {
        return 
apply_filters('month_link'home_url'?m=' $year zeroise($month2) ), $year$month);
    }
}
?>

Examples [ wp-snippets.com ]

Top Google zoekresultaten

Meer ...

0 User Note(s)

Nog geen één. Wees de eerste!

Nieuw toevoegen ...



HTML5 Powered with CSS3 / Styling, Performance & Integration, and Semantics