Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Add extra filter in sb_nav_menu #60

Open
Pypeline opened this issue Aug 2, 2013 · 2 comments
Open

Enhancement: Add extra filter in sb_nav_menu #60

Pypeline opened this issue Aug 2, 2013 · 2 comments

Comments

@Pypeline
Copy link
Contributor

Pypeline commented Aug 2, 2013

sb_nav_menu has 2 filters in it: sb_nav_menu_defaults and sb_{$menu_id}_menu.

the second one seems relatively useless because just returns all of the html for the menu.

My main point is to add a filter immediately after the first one, sb_nav_menu_defaults (line 41 in includes/functions/menus.php). Currently, you can filter defaults but there's no way to target a specific menu (which is what I had wanted to do).

All that would be needed is this:
$r = apply_filters( "sb_nav_menu_args", $r );
just after the sb_nav_menu_defaults filter and you have access to all of a menu's arguments before they get created by wp_nav_menu. My use for this was adding separators between menu items on just 1 of my 3 menus.

Sidenote, I don't know if it's proper etiquette to just submit a pull request or to ask about it here first. I'd be happy to submit the pull if this is a thumbs up.

@brichards
Copy link
Contributor

Sounds logical, and pull request is welcome :)

In fact, opening an issue and the immediately following with a PR is totally okay (preferred, even). GitHub makes it super easy to review and discuss specific lines of code, and you can continue to commit code as part of your PR until it is eventually merged or closed. It's a very slick process!

I would call the new filter sb_nav_menu_{$menu_id}_args, I think.

@Pypeline
Copy link
Contributor Author

Pypeline commented Aug 6, 2013

It would actually have to be sb_nav_menu_{$r['menu_id']}_args.
Pull request incoming shortly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants