Reputation
Top tag
Next privilege 200 Rep.
See reduced ads
Badges
1 8
Impact
~9k people reached

  • 0 posts edited
  • 0 helpful flags
  • 11 votes cast
Jul
29
revised add_action with a class method is causing fatal errors
Found the issue
Jul
29
revised add_action with a class method is causing fatal errors
Fixed a typo (DEMenu -> MyClass)
Jul
29
comment add_action with a class method is causing fatal errors
Now test.php is functioning properly, but the Walker class is still messed up... I'm going to edit my original question to include my simplified plugin class.
Jul
29
comment add_action with a class method is causing fatal errors
Actually, I just figured it out. Instead of public static function MyClass(){ it should be just function MyClass(){. That's actually probably what problem was all along. I kept using public static function instead of public function.
Jul
29
comment add_action with a class method is causing fatal errors
This gave me a new error: Fatal error: Constructor MyClass::MyClass() cannot be static in /home/coupon/public_html/wp-content/plugins/test.php on line 11
Jul
29
asked add_action with a class method is causing fatal errors
Jul
28
revised How do I access the menus produced by Dashboard > Appearance > Menus
Original problem is solved with help from SO. New problem now.
Jul
28
accepted How do I access the menus produced by Dashboard > Appearance > Menus
Jul
28
comment How do I access the menus produced by Dashboard > Appearance > Menus
I actually just realized (with the help of a response to stackoverflow.com/questions/6862887/…) that I can use wp_nav_menu_args to pass my own custom walker class. For the recommendation to look at available filters, I'm accepting this answer as it does answer the original question. Although I recently have a problem with my Walker class, I can make a new question for this...
Jul
28
revised How do I access the menus produced by Dashboard > Appearance > Menus
Solved the non-object issue, now class-wp-walker.php is broken...
Jul
28
awarded  Editor
Jul
28
revised How do I access the menus produced by Dashboard > Appearance > Menus
Appended modified plugin class as well as new issue with $args not being an object
Jul
28
comment How do I access the menus produced by Dashboard > Appearance > Menus
Problem is (mentioned in the previous question) I wanted to make this plugin with the assumption that I had no power to edit the theme (since it will be used on multiple different themes and the client may likely change themes at some point in time). My solution so far was to copy/paste the code from nav-menu-template.php except for this line: $items .= walk_nav_menu_tree( $sorted_menu_items, $args->depth, $args );. I can change this line to implement my own walker. However this means wp_nav_menu() is essentially run twice, with the first output discarded. Kind of wasteful.
Jul
28
comment How do I access the menus produced by Dashboard > Appearance > Menus
For options I was going by WordPress's own documentation: codex.wordpress.org/Writing_a_Plugin Although I don't have any options yet. At the moment I'm making this a very simple plugin that will support one use case, then I'll expand it and add options as necessary. Although I have been reading through core.trac.wordpress.org/browser/tags/3.2.1/wp-includes/… to find the best method of accessing menu items. Since I want to edit the menu output and not the item list I think I may have to re-generate the item list (silly, I know)...
Jul
28
awarded  Student
Jul
28
asked How do I access the menus produced by Dashboard > Appearance > Menus
Jul
28
awarded  Supporter
Jul
28
awarded  Scholar
Jul
28
accepted Replacing WordPress menu functionality with a plugin
Jul
28
comment Replacing WordPress menu functionality with a plugin
Ah. I didn't have a menu defined. That actually resolved the entire issue. I can't believe I spent the entire morning looking up walker classes and how to override WordPress functions when I had it right from the start. Thank you.