Welcome to Geeklog, Anonymous Sunday, May 26 2024 @ 02:07 pm EDT

Question: How do I change the menu?

Answer: Most themes use the variable {menu_elements} in their header.thtml file. This variable is replaced with a set of menu entries.

In Geeklog 1.3.9 and earlier versions, those menu entries were hard-coded into Geeklog, so if you want to change these entries, you will have to remove the {menu_elements} variable and replace it with the actual links to the items you want.

Starting with Geeklog 1.3.10, there is a configuration variable in your config.php that lets you choose which menu entries will be used for {menu_elements} and in which order they will be displayed. The variable is $_CONF['menu_elements'] and consists of a comma-separated list of keywords, each of which represents a menu entry (see the comments in config.php for details).

As of Geeklog 1.5.0, the menu elements can be changed in the "Theme" section of the Configuration admin panel.

Custom entries

It is also possible to add your own entries to that list through the use of the 'custom' keyword and a function called CUSTOM_menuEntries that you'll have to implement in your lib-custom.php. It should return an array of (menu text, link) entries (see lib-custom.php for details).

A much simpler method of adding your own entries would be to simply hard-code them in the header.thtml file of your theme, near {menu_elements}.

Plugin entries

The 'plugins' keyword will let plugins add their entries to the menu (e.g. Static Pages where the "Add To Menu" checkbox is activated).

Additionally, the variable {plg_menu_elements} (in header.thtml) can be used to have the plugin menu entries in a separate place than the standard menu entries.

Please note that the use of the 'plugins' keyword in $_CONF['menu_elements'] will add all plugin entries to {menu_elements}, so you may up end with duplicate plugin entries if your theme uses both the {menu_elements} and the {plg_menu_elements} variable.

To remove a plugin's entry from the menu, check with the plugin's documentation to see if it has an option to switch off the menu entry (typically in its config.php file). If it doesn't, find the plugin's functions.inc file and in that file the function that's named plugin_getmenuitems_plugin-name and either remove that function or comment it out.

Misc. notes

Please note that not all themes use these variables. For example, the XSilver theme uses {plg_menu_elements} but not {menu_elements}.

If all you're trying to do is changing the actual text of the menu entries, please see Where can I change the text ...?

Hits: 483

FAQ » Usage » How do I change the menu?