Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Use Link as Menu item ?
#1
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
Reply
#2
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>
- 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
#3
Thanks for the tip Smile

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

Thanks !
Reply
#4
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.
“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
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.
Reply
#6
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>
Reply
#7
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
Reply
#8
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".
I18N, I18N Search, I18N Gallery, I18N Special Pages - essential plugins for multi-language sites.
Reply
#9
Thank you very much!
Reply




Users browsing this thread: 1 Guest(s)