<?php
query_posts("cat=4");
if (have_posts()) : while (have_posts()) : the_post();
$k = get_the_category($post->ID);
if ( $k[0]->cat_ID == $cat ) {
echo '<li><a href="'; the_permalink(); echo'" rel="bookmark">';
the_title();
echo '</a></li>';
} endwhile; else:
endif;
?>
<?php
$current_cat = get_query_var('cat');
global $ancestor;
$childcats = get_categories('child_of='.$current_cat.'&hide_empty=0&orderby=id');
foreach ($childcats as $childcat) {
if (cat_is_ancestor_of($ancestor, $childcat->cat_ID) == false){
echo '<li><a href="#projects" data-filter=".'; echo $childcat->slug;
echo '">';
echo $childcat->cat_name . '</a></li>';
$mycat=get_the_category(); $mycat=$mycat[0];
$postslist = get_posts('posts_per_page=-1&category='.$childcat->cat_ID);
?>
<? $ancestor = $childcat->cat_ID; } } ?>
<?php
// получаем категории
$categories = get_categories(array(
'hide_empty' => false,
));
foreach ($categories as $cat) {
// получаем подкатегрии
$sub_cat = get_categories(array(
'orderby' => 'name',
'parent' => $cat->term_id,
'hide_empty' => false,
));
foreach ($sub_cat as $cat) {
// получаем подкатегрии подкатегорий
$sub_sub_cat = get_categories(array(
'orderby' => 'name',
'parent' => $cat->term_id,
'hide_empty' => false,
));
foreach ($sub_sub_cat as $cat) { ?>
<a href="<?php echo get_category_link( $cat->term_id ); ?>"><?php echo $cat->cat_name; ?></a>
<?php } ?>
<?php } ?>
<?php } ?>