• Здравствуйте.

    Скчала плагин charted-archives, он очень легкий и простой, но едиственное,что я не могу понять как переименовать месяца на русские, в плагин залезла, но так и не смогла понять где именно менять.

    вот код который как я понимаю отвечает за вывод месяца.

    //The function to build the archives
    function Charted_Archives($rows) {
    	global $wpdb;
    	$table = $wpdb->prefix . 'posts';
    	if ($rows == '' || $rows == 0) { $rows = 7; }
    	$sql = 'select count(*) as n, monthname(post_date) as monthname, month(post_date) as month, year(post_date) as year from ' . $table . ' where post_type = "post" and post_status != "future" group by year, month order by year desc, month desc limit ' . $rows;
    	$months = $wpdb->get_results($sql);
    	$months = array_reverse($months);
    	$start = (count($months) - $rows);
    	$str = '<ul id="archive_bar_graph">';
    	foreach ($months as $month) {
    		$str .= '<li><span class="label">' . substr($month->monthname,0, 3) . '</span>';
    		$str .= '<a href="/' . $month->year . '/' . $month->month . '" title="Архив за ' . $month->monthname . ' ' . $month->year . '">';
    		$str .= '<span class="count" style="height:'. $month->n . '0px;">' . $month->n . '</span></a></li>';
    	}
    	$str .= '</ul><br style="clear: both" />';
    	echo $str;
    }

    подскажите пожалуйста как все таки переименовать названия месяцев на русский,зарание спасибо

Просмотр 1 ответа (всего 1)
  • Модератор Sergey Biryukov

    (@sergeybiryukov)

    Live and Learn

    Можно вместо

    $str .= '<li><span class="label">' . substr($month->monthname,0, 3) . '</span>';
    $str .= '<a href="/' . $month->year . '/' . $month->month . '" title="Archives for ' . $month->monthname . ' ' . $month->year . '">';

    написать:

    $str .= '<li><span class="label">' . __(substr($month->monthname,0, 3) . "_{$month->monthname}_abbreviation") . '</span>';
    $str .= '<a href="/' . $month->year . '/' . $month->month . '" title="Архивы за ' . __($month->monthname) . ' ' . $month->year . '">';

Просмотр 1 ответа (всего 1)

Тема «Месяца архива» закрыта для новых ответов.