ThemeShaper Forums » Thematic

[closed]

Second wp_page_menu with different classes?

(4 posts)
  • Started 4 years ago by danielbaars
  • Latest reply from danielbaars
  • This topic is not resolved
  1. danielbaars
    Member

    I have a design that calls for an extra wp_page_menu in the footer. Because of this code in header-extensions.php:

    function thematic_add_menuclass($ulclass) {
    return preg_replace('/

      /', '<ul class="sf-menu">', $ulclass, 1);
      } // end thematic_add_menuclass
      add_filter('wp_page_menu','thematic_add_menuclass');

    every wp_page_menu has the class "sf-menu". What can I put in my child theme's functions.php so the menu in the footer gets the class "footer-menu" instead?

    I am aware that this particular "problem" is probably more easily solved via CSS but for learning purposes I would like to do it through altering my functions.php file.

    Cheers,

    DB

    Posted 4 years ago #
  2. Hi Daniel,

    I changed this behavior in the latest SVN copy. The class 'sf-menu' will only be added to the main menu in the header. For your footer menu you can use this code:

    echo preg_replace('/<ul>/', '<ul class="footer-menu">', wp_page_menu(thematic_page_menu_args()), 1);

    Chris

    Posted 4 years ago #
  3. danielbaars
    Member

    Hi Chris,

    Thanks so much for your reply. It is obvious that I have a LOT to learn 'cause I don't know what to do with the code you provided. I have installed the latest SVN copy and indeed the second menu does not have the 'sf-menu' class now. However, I have tried using your code in my functions.php in several, no doubt dumb, ways but all I get is error messages or no result at all.

    To be honest, reading through the header-extensions.php file I don't really get enough of it to understand why the second wp_page_menu doesn't have the same class as the first one. I see that there's now a difference between a page_menu and a nav_menu? But the why's and how's totally escape me. I guess I should really bite the bullet and learn more about PHP in general, perhaps that would help.

    Regards,

    Daniel

    Posted 4 years ago #
  4. danielbaars
    Member

    On a slightly related note:

    I tried adding the 'depth' atribute to thematic_page_menu_args (directly in header-extensions.php) but it had no effect. Should I set it somewhere else?

    Posted 4 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.