Title: WordPress using its own classes?
Last modified: August 18, 2016

---

# WordPress using its own classes?

 *  [stardog](https://wordpress.org/support/users/stardog/)
 * (@stardog)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/)
 * Lets say I use something like to display my pages:
 * `<?php wp_list_pages(); ?>`
 * That codes creates all this:
 * `<li class="pagenav">Pages<ul><li class="page_item"><a href="pagename" title="
   Page Name">Page Name</a></li></ul></li>`
 * Is it FORCING me to add those classes to my stylesheet and use those instead 
   of my own?
 * I don’t even want the pages I have to be put into a list either. How do I control
   it without changing all the files outside my template’s directory?

Viewing 4 replies - 1 through 4 (of 4 total)

 *  [drmike](https://wordpress.org/support/users/drmike/)
 * (@drmike)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/#post-530141)
 * You may want to review the codex page as you can set options for that template
   tag.
 * [Template_Tags/wp_link_pages](http://codex.wordpress.org/Template_Tags/wp_link_pages)
 * Hope this helps,
    -drmike
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [19 years, 3 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/#post-530235)
 * And if absolutely necessary (which it is sometimes to get rid of markup) you 
   can edit the function itself.
 *  [kalico](https://wordpress.org/support/users/kalico/)
 * (@kalico)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/#post-530648)
 * Server borked, created a double post. The next one is the one I intended to post….
 *  [kalico](https://wordpress.org/support/users/kalico/)
 * (@kalico)
 * [18 years, 11 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/#post-530649)
 * I don’t get why the wp_list_pages function is contained in LI tags at all….that
   is totally non-standard code. Unless you are ALWAYS going to nest it inside another
   list, I can’t imagine why this would be hard coded into the WP core.
 * But as Root said, it can be changed by editing the function itself. Here are 
   instructions for 2.1.3. Other versions are probably similar. Don’t forget to 
   make a back up before you do this!!!
 * You’ll be changing this file:
 * /wp-includes/post_functions.php.
 * Locate “function wp_list_pages” (line 265 in my 2.1.3)
 * Look for the “if” statement and remove the opening and closing LI tags in the
   two lines `?output=` (one of them includes class=pagenav), so it reads as follows:
 *     ```
       if ( !empty($pages) ) {
       		if ( $r['title_li'] )
       			$output .= '' . $r['title_li'] . '<ul>';
   
       		global $wp_query;
       		if ( is_page() )
       			$current_page = $wp_query->get_queried_object_id();
       		$output .= walk_page_tree($pages, $r['depth'], $current_page, $r);
   
       		if ( $r['title_li'] )
       			$output .= '</ul>';
       	}
       ```
   
 * When looking at the whole function, you’ll see you can also remove the page_item
   class for the inner nested LIs if you want, but you can also just not define 
   that class in CSS and it won’t do anything.
 * I have been battling this weird nesting problem for ages, and this thread finally
   led me to the solution, so I thought it might help someone else down the road
   to have it posted in detail.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘WordPress using its own classes?’ is closed to new replies.

## Tags

 * [classes](https://wordpress.org/support/topic-tag/classes/)

 * 4 replies
 * 4 participants
 * Last reply from: [kalico](https://wordpress.org/support/users/kalico/)
 * Last activity: [18 years, 11 months ago](https://wordpress.org/support/topic/wordpress-using-its-own-classes/#post-530649)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
