GetSimple Support Forum

Full Version: Use Link as Menu item ?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hello

How can I use a Link as Menu item ? I can't find this option anywhere. I only have the ability to create a new page, but I don't want that. I want a link e.g. google.com as a menu item. How do I do that ?

Thanks
In your template, do something like this:
Code:
<ul id="nav">
      <?php get_navigation(return_page_slug()); ?>
      <li><a href="http://www.google.com" >Google</a></li>
</ul>
Thanks for the tip Smile

How can I create a link as a sub-menu item ?

Thanks !
freekers Wrote:How can I create a link as a sub-menu item?
This is currently impossible because you can’t change the menu structure from the way it’s generated by get_navigation(). This will be supported through a plugin filter (menuitems) in the next version of GetSimple.
I'm surprised that the ability to use an external url as a menu item was overlooked (page management seems to be one of the weak spots in GetSimple). While a template adjustment will work in this case, it is beyond the ability of my clients who are managing the site with the backend UI.

Please add this to your upcoming feature list as well as a drag-able UI for arranging the page order.
I had cobbled together a quick plugin to play with the $menuitems variable. This plugin turns the linst items into an array, then adds entries into the array. Consider it a starting point for anyone who wants to write a "custom menu link" plugin.
Code:
<?php
/*
Plugin Name: Menu Modify
Description: Modifies the Menu
Version: 0.1
Author: Rob Antonishen
Author URI: http://ffaat.pointclark.net
*/

# get correct id for plugin
$thisfile=basename(__FILE__, ".php");

# register plugin
register_plugin(
    $thisfile,
    'Menu Modify',    
    '0.1',        
    'Rob Antonishen',
    'http://ffaat.pointclark.net',
    'Modifies the menu',
    'theme',
    'menu_show'  
);

# activate filter
add_filter('menuitems','menu_filter');


function menu_show() {}

function menu_filter($menuitems) {
  preg_match_all("/<li(.*)?>(.*?)<\/li>/",$menuitems,$menuarray);
  #insert at start
  #array_splice($menuarray[0],0,0,'<li><a href="http://something.com" title="New Menu Item">New Item</a></li>');
  #insert at end
  array_splice($menuarray[0],count($menuarray[0]),0,'<li><a href="http://www.google.com" title="Google">Google</a></li>');
  $menuitems = implode($menuarray[0]);
  return $menuitems;
}
?>

-Rob A>
Hello,

I think what you are trying to do is not possible because you are not change the menu structure from the way it’s generated by get_navigation().

Good luck
ajackson Wrote:I think what you are trying to do is not possible because you are not change the menu structure from the way it’s generated by get_navigation().

See here - "Internal/external Links".
Thank you very much!