1)?$r:’0′.$r;
$g = dechex(255-hexdec(substr($color,2,2)));
$g = (strlen($g)>1)?$g:’0′.$g;
$b = dechex(255-hexdec(substr($color,4,2)));
$b = (strlen($b)>1)?$b:’0′.$b;
return ($prependHash?’#’:NULL).$r.$g.$b;
}
function sp_html_sitemap() {
$category = true; // показывать блок с постами, false – не показывать, true – показывать
$categoryDate = false; // показывать дату написания поста, false – не показывать, true – показывать
$categoryExclude = ‘258, 274, 287, 270, 301, 320’; // номера категорий через запятую, что надо исключить, в противном случаи оставить переменную пустой (т.е. два опострофа)
$categoryEmpty = false; // показывать пустые категорий, false – показывать, true – не показывать
$page = false; // показывать блок со страницам, false – не показывать, true – показывать
$pageExclude = ”; // номера страниц через запятую, что надо исключить, в противном случаи оставить переменную пустой (т.е. два апострофа)
$author = false; // показывать блок с авторами, false – не показывать, true – показывать
$authorExcludeAdmin = false; // исключить из списка авторов пользователя с логином admin, false – не исключать, true – исключить
$color = array(“fff”, “fff”, “fff”, “fff”, “fff”, “fff”, “fff”, “fff”, “fff”, “fff”, “fff”);
$cc = 0;
$result = ‘
if ($category) {
$result .= ‘
$cats = get_categories(array(
‘orderby’ => ‘name’,
‘hierarchical’ => false,
‘exclude’ => $categoryExclude,
‘hide_empty’ => $categoryEmpty,
));
$result .= ‘
Публикации
‘;
foreach ($cats as $category) {
if($category->name<>“*Все статьи*”){
if($cc > count($color)){$cc = 0;}
$result .= ‘
//$result .= ‘‘;
query_posts(array(‘cat’ => $category->cat_ID,’showposts’=>70,’orderby’ => ‘date’, ‘order’ => ‘DESC’ ));
$i = 0;
$result .= ‘
- ‘;
while (have_posts()) {
the_post();
$cat = get_the_category();
//foreach (
// if ($cat[0]->cat_ID == $category->cat_ID OR $cat[1]->cat_ID == $category->cat_ID) {
if ($cat[1]->cat_ID == $category->cat_ID) {
if($i == 10){ $result .= ‘
- ‘;}
- ‘.get_the_title().’‘;
$result .= ($categoryDate)?’ (‘.get_the_time(‘d.m.Y’).’)‘:”;
$result .= ‘
$result .= ‘
‘;
$i++;
}
}
wp_reset_query();
$result .= ‘
‘;
$cc++;
}}
$result .= ‘
‘;
}
if ($page) {
$result .= ‘
Страницы
- ‘;
$result .= wp_list_pages(
array(
‘exclude’ => $pageExclude,
‘title_li’ => ”,
‘echo’ => false,
)
);
$result .= ‘
‘;
}
if ($author) {
$result .= ‘
Авторы
- ‘;
$result .= wp_list_authors(
array(
‘exclude_admin’ => $authorExcludeAdmin,
‘echo’ => false,
)
);
$result .= ‘
‘;
}
$result .= ‘
‘;
wp_reset_query();
echo $result;
}
?>