Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress menu classnames

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #27112
    Oskar
    Participant

    Hi,

    I can’t find any way to manually edit the classes applied to my wp_list_pages(); function. I would really like to have classes applied to the a-tag as well as the li-tag.

    Anyone know of a useful plugin or something?

    I’m afraid there’s no standard way of doing it.

    #67690
    JaredAM
    Member

    I’m new to the whole hacking wordpress so if this isn’t the WordPress Approved Method, I’d like to know the answer as well.

    But it seems to me you can basically just add stuff like this:

    <div class="bbcode_code">
      <div class="bbcode_code_head">
        Code:
      </div>
    
      <div class="bbcode_code_body" style="white-space:pre">
        //Get the stuff from wp_list_pages $myvar = wp_list_pages('echo=0&title_li='); // Find the li to add a class to $var1 = '<li class="'; $var2 = '<li class="myclass '; //Find the a to add a class to $var3 = '<a'; $var4 = '<a class="myclassa" '; // Replace var1 with var 2, and var 3 with var 4. $myvar = str_replace($var1, $var2, $myvar); $myvar = str_replace($var3, $var4, $myvar); //print out the resulting stuff print "myvar = " . $myvar;
      </div>
    </div>
    
Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.