Title: Navigation php query
Last modified: August 19, 2016

---

# Navigation php query

 *  [kyllle](https://wordpress.org/support/users/kyllle/)
 * (@kyllle)
 * [16 years, 2 months ago](https://wordpress.org/support/topic/navigation-php-query/)
 * Hi all,
 * I have created a drop down nav using the following php:
 *     ```
       // Add ID and CLASS attributes to the first
       <ul> occurence in wp_page_menu
       function add_menuclass($ulclass) {
       return preg_replace('/</ul>
       <ul>/', '<ul id="main_nav">', $ulclass, 1);
       }
       add_filter('wp_page_menu','add_menuclass');
       ```
   
 * This is ok because it adds main_nav to the first ul navigation. My problem is
   though that I also need to add ul id=sub_nav to the first child of the navigation
   which Im having some trouble doing, has anyone any suggestions on how I could
   achieve this?
 * Thanks in advance!
 * Kyle

The topic ‘Navigation php query’ is closed to new replies.

 * 0 replies
 * 1 participant
 * Last reply from: [kyllle](https://wordpress.org/support/users/kyllle/)
 * Last activity: [16 years, 2 months ago](https://wordpress.org/support/topic/navigation-php-query/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
