Support » Fixing WordPress » wp_list_pages styling

  • Hi,
    Just have one quick question, I know there is a way to style wp_list_pages but I don’t know how. Also, I have a css tag that is set up so it does the following:
    Sub Content
    Sub Sub Content
    but it just uses 1 tag or two. 🙂 But it only works if I can set how WordPress puts in the tag for the different parts in the “Tree”. Thanks…

Viewing 4 replies - 1 through 4 (of 4 total)
  • sure, I did this myself only minutes ago with css!

    open your wp-includes/template-functions-post.php and locate this line: function wp_list_pages($args = '') {.

    10 lines further down you will find this line: $output .= "<li>" . $r["title_li"] . "<ul>";.

    Add class=\"pages\" to the <ul>.

    Make an imagetag for the Sub-pages and another one for the subsub-pages, and go to your CSS file and add these lines:

    ul.pages ul li:before {
    content: url('wp-content/themes/YOURTHEME/images/subpages.png');

    ul.pages ul ul li:before {
    content: url('wp-content/themes/YOURTHEME/images/subsubpages.png');

    give it a try. should work for you if you get what i’m talking about 🙂

    krugern, Thanks…
    THe class part is good but if I understand you correctly I should be able to change the
    <ul> to li? Also is there a way to do what I want with out modifying the WP functions? Because as soon as I upgrade I will have to do the same thing again.

    I echo ttech5593. How can we modify the WP functions without upgrading becoming a hassle?

    I’m kind of a newbie on css, but if you want to change the ul and li items, you could change them in the stylesheet. However, that would probably change them everywhere, which is what you don’t want. The suggestion was to change the function to add a class to it, so that you could then add this to the stylesheet. But then you would loose this on the next upgrade.

    Maybe it would be good to have different internal wp functions each have their own class, so that each can be customized.

    And there are some replacement plugins like

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘wp_list_pages styling’ is closed to new replies.