WordPress.org

Forums

first and last css classes on a dynamic sub menu (1 post)

  1. tjsherrill
    Member
    Posted 5 years ago #

    I am using the following code:

    <div id="sub_menu">
    	<?php
      		if($post->post_parent)
      			$children = wp_list_pages("title_li=&child_of=".$post->post_parent."&echo=0");
      		else
      			$children = wp_list_pages("title_li=&child_of=".$post->ID."&echo=0");
      		if ($children) { ?>
      			<ul>
      				<?php echo $children; ?>
     			</ul>
      	<?php } ?>
    		</div>

    To list a submenu of a parent page. I want to try and figure out how to add .first and .last css classes to the menu. Is that possible?

Topic Closed

This topic has been closed to new replies.

About this Topic