Merhabalar bir yerde takılı kaldım

1 Kategoriye ait alt kategorileri ve alt kategorilere girilen içeriklier listeletmeye çalışıyorum fakat bir türlü beceremedim.

Yapmak istediğim şey görsel olarak şu:


<div class="kenarlik">	
<?php
    $cat=get_categories('hide_empty=0&child_of=20');
 
    foreach($cat as $liste){
        if($liste->category_parent==20){ ?>
			<div class="Baslik">
            <h2><?php echo $liste->cat_name; ?></h2>
			<span class="devami">
				<a href="http://localhost/haber">TAMAMINI GÖR</a>
			</span>
			</div>
            <?php
                if( $category[0]->cat_ID == $liste->cat_ID || $category[1]->cat_ID == $liste->cat_ID){ ?>
                    <ul>
                        <?php
                            $subcat=get_categories('hide_empty=0&child_of='.$liste->cat_ID);
                            foreach($subcat as $altliste){ ?>
                                <li><a href="<?php bloginfo('wpurl'); ?>/category/<?php echo $liste->category_nicename; ?>/<?php echo $altliste->category_nicename; ?>"><?php echo $altliste->cat_name; ?></a></li>
                        <?php }?>
                    </ul>
            <?php } ?>    
 
    <?php } } ?>
			<ul>
			<li>
				<a href="http://localhost/haber/haber-6.html">
					<span class="gorsel">
						<img src="http://localhost/haber/images.png" width="63" height="48"/>
					</span>
					<span class="yazi">
						<span class="yazi1">Haber Başlık</span>
						<span class="yazi2">Haber Özet...</span>
					</span>
				</a>
			</li>
		</ul>
</div>