• Hey there!
    im trying to stylize the right menu here => https://www.assessortec.com/wp/?page_id=7
    like this:
    where the parent pages stays inside a <div> tag with background class and stuffs, aaand the subpages stays just like it is right now on lists.

    the code im using:

    <?php
    if(!$post->post_parent){
    	// will display the subpages of this top level page
    	$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
    }else{
    	// diplays only the subpages of parent level
    	//$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
    
    	if($post->ancestors)
    	{
    		// now you can get the the top ID of this page
    		// wp is putting the ids DESC, thats why the top level ID is the last one
    		$ancestors = end($post->ancestors);
    		$children = wp_list_pages("title_li=&child_of=".$ancestors."&echo=0");
    		// you will always get the whole subpages list
    	}
    }
    
    if ($children) { ?>
    	<ul id="produtos">
    		<?php echo $children; ?>
    	</ul>
    <?php } ?>

    how to style title_li inside DIVs and &child_of= inside lists ??

    thanks

  • The topic ‘stylize wp_list_pages’ is closed to new replies.