Posts: 19
Threads: 5
Joined: Feb 2010
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.
Posts: 679
Threads: 80
Joined: Nov 2009
Would you like the hook above the first or after the last li?
I think after the last li would be nice.
Posts: 19
Threads: 5
Joined: Feb 2010
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.
Posts: 972
Threads: 27
Joined: Aug 2009
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:
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.
Posts: 3,491
Threads: 106
Joined: Mar 2010
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);
Posts: 1,848
Threads: 86
Joined: Aug 2009
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!