Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Add to menu
#1
Hey,

An add to menu hook would be very helpful, as theres a lot of code wasted in my current way to of doing thing.

having a blank page called "store" then having everything run under a content-top hook and a function that checks to make sure everthing is only displayed on the "store" page.

Im sorry if that makes little sense, I just woke up and have yet to have my coffee.
Reply
#2
Would you like the hook above the first or after the last li?

I think after the last li would be nice.
JWH Technologies
Have any marketing ideas for Get-Simple? Let me hear them!
Reply
#3
I would like to able to choose in the hook itself, so that its location can be suited to each plugin/menu by the user. But if i had no choice then the after the last li would be best i belive.
Reply
#4
Choosing a location to have the hook the way the menu function is currently working will be a bit hard. It will be easy to add some hooks before and after the generated LI-elements. I haven’t committed this to the latest dev version (yet) but here’s what you could do:

Open up /admin/inc/theme_functions.php and scroll all the way down (row 362). Here you will find this:
Code:
echo $menu;
Now change it to this:
Code:
exec_action('pre-menuitems');
echo $menu;
exec_action('post-menuitems');
Now use these two hooks (pre-menuitems, post-menuitems) as normal.

I’ll be looking into this a bit for the next GetSimple version. It would be nice to have a little more control over the menu as plugin developers.
“Don’t forget the important ˚ (not °) on the a,” says the Unicode lover.
Help us test a key change for the core! ¶ Problems with GetSimple? Be sure to enable debug mode!
Reply
#5
Maybe just the pre-menuitems hook is needed for this -- instead of echoing the additional "<li>..." code, it could be appended to the $menu variable (to the beginning or end of the string, depending on where you want it to be displayed).

Another idea... What about using a filter, instead of hooks?
Line 362 of theme_functions.php could then be changed to:
Code:
echo exec_filter('menuitems',$menu);
Reply
#6
Carlos Wrote:cho exec_filter('menuitems',$menu);
I like your idea... i've just added it to the core. Thanks Carlos!
- Chris
Thanks for using GetSimple! - Download

Please do not email me directly for help regarding GetSimple. Please post all your questions/problems in the forum!
Reply




Users browsing this thread: 1 Guest(s)